$ irb -rnarray
irb(main):001:0> a=NArray.float(3,2,2).indgen
=> NArray.float(3,2,2):
[ [ [ 0.0, 1.0, 2.0 ],
[ 3.0, 4.0, 5.0 ] ],
[ [ 6.0, 7.0, 8.0 ],
[ 9.0, 10.0, 11.0 ] ] ]
irb(main):002:0> b=NArray[1..3]
=> NArray.int(3):
[ 1, 2, 3 ]
irb(main):003:0> a*b
=> NArray.float(3,2,2):
[ [ [ 0.0, 2.0, 6.0 ],
[ 3.0, 8.0, 15.0 ] ],
[ [ 6.0, 14.0, 24.0 ],
[ 9.0, 20.0, 33.0 ] ] ]
irb(main):004:0> (a*b).sum(0)
=> NArray.float(2,2):
[ [ 8.0, 26.0 ],
[ 44.0, 62.0 ] ]
irb(main):005:0> a.mul_add(b,0)
=> NArray.float(2,2):
[ [ 8.0, 26.0 ],
[ 44.0, 62.0 ] ]