Basically, I want to perform column wise scalar multiplication of a matrix A and vector B. Where every column of matrix A is multiplied by the corresponding value in vector B. I have a method that looks like this.
def scale_matrix(self, matrix, vector):
"""
Performs scalar multiplication of matrix and vector column wise
"""
for value, index in enumerate(vector):
matrix[:, index] *= value
return matrix
I am using numpy somewhere else in my code, I was wondering if this can be achieved using only numpy?