[Numpy-discussion] Matrix operation.
Fri Apr 2 09:35:44 CDT 2010
Let A be a square matrix of 0's and 1's, and let X be a one dimesional
The length of X is equal to the number of 1's that A has.
I would like to produce a new matrix B by traversing the matrix A row by row
1- whenever i find a 0, set B in that position to zero.
2- whenever i find a 1, set B in that position with the ith value of X
(where i represents the ith time i found a 1).
Which is an efficient way to accomplish this using numpy?
View this message in context: http://old.nabble.com/Matrix-operation.-tp28119663p28119663.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion