Method: RMath3D::RMtx2#*
- Defined in:
- lib/rmath3d/rmath3d_plain.rb
#*(arg) ⇒ Object
call-seq: *
mtx1 * mtx2 : Binary multiply operator.
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/rmath3d/rmath3d_plain.rb', line 412 def *( arg ) case arg when Fixnum, Float, Bignum return RMtx2.new( arg*self.e00, arg*self.e01, arg*self.e10, arg*self.e11 ) when RMtx2 result = RMtx2.new for row in 0...2 do for col in 0...2 do sum = 0.0 for i in 0...2 do sum += getElement( row, i ) * arg.getElement( i, col ) end result.setElement( row, col, sum ) end end return result else raise TypeError, "RMtx2#*(arg) : Unknown type #{arg.class} given." return nil end end |