in my code i am trying to normalise a matrix as below

mymatrix=matrix(..# items are of double type..can be negative
values....)
numrows,numcols=mymatrix.shape

for i in range(numrows):
        temp=mymatrix[i].max()
        for j in range(numcols):
                mymatrix[i,j]=abs(mymatrix[i,j]/temp)

# i am using abs() to make neg vals positive

this way the code takes too much time to run for a case of
numrows=25, and numcols=8100 etc..
being a beginner in numpy and python ,i would like to know if this can
be done more efficiently..can anyone advise?

thanx
dn
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to