I am trying to use scipy and numpy to perform matrix addition and multiplication.
I have 2 matrix "a" and "b". my goal is to add "a" and "b" together and store the result into a matrix "c"
Also I want to multiply "a" and "b" and store into a matrix "d".
Are there any function perform like that in Scipy/Numpy?
Thanks a lot.
Matrix multiplication:
a = numpy.matrix(a)
b = numpy.matrix(b)
c = a+b
d = a*b
Array multiplication (map operator.mul):
a = numpy.array(a)
b = numpy.array(b)
c = a+b
d = a*b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With