import numpy as np
M = np.matrix([
[-1,-2,-3],
[-4,-5,-6]
])
print(M)
i
or column j
with a scalar?To multiply a particular column:
M[:,colnumber] *= scalar
Or a row:
M[rownumber,:] *= scalar
And of course, accessing them as an iterable is the same thing:
col_1 = M[:,1]
Although, that gives you a new matrix, not a list
. Although, honestly, I can't quite seem to figure out all of these operations with matrix
objects -- And these don't really seem like matrix
type operations. Is there a reason that you're using matrix
instead of array
objects? If you want matrix multiplication, you can always use np.dot(array_mat1, array_mat2)
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