[SciPy-user] Matlab to scipy

Nils Wagner wagner.nils at vdi.de
Fri Oct 24 11:13:53 EDT 2003


------------------- 
 
 
On Fri, 24 Oct 2003, Nils Wagner wrote: 
 
> [y,i] = max(X) stores the indices of the maximum values in  
> vector i. If there are several identical maximum values, the  
> index of the first one found is returned.  
> So   
> y = MLab.max(abs(A[k:n,k:n]))  
> But, how can I evaluate i in scipy ?  
 
Try i?amax functions from linalg.fblas, For example, 
 
>>> A 
array([[ 3.,  4.,  1.], 
       [ 1.,  2.,  3.], 
       [-2., -1.,  0.]]) 
>>> i=map(linalg.fblas.idamax,transpose(A)) 
>>> y=map(lambda a,j:a[j],transpose(A),i) 
>>> y,i 
([3.0, 4.0, 3.0], [0, 0, 1]) 
 
while in Matlab: 
 
>> [y,i]=max(A)   
y = 
     3     4     3 
i = 
     1     1     2 
 
 
HTH, 
	Pearu 
 
Pearu, 
 
I have still some problems with the conversion. 
Maybe this is due to different indexing. 
I have enclosed the program. Hopefully someone 
will find the bug. 
 
Afaik, only partial pivoting is available in the 
current version of scipy. Might it be an idea 
to add complete pivoting ? 
 
Thank you again. 
 
Nils 
 
_______________________________________________ 
SciPy-user mailing list 
SciPy-user at scipy.net 
http://www.scipy.net/mailman/listinfo/scipy-user 
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: complete.py
Type: application/octet-stream
Size: 1311 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20031024/f490ca24/attachment.obj>


More information about the SciPy-User mailing list