comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: the (Moore-Penrose) pseudo-inverse of a matrix - anything like scipy.linalg's pinv2 in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: the (Moore-Penrose) pseudo-inverse of a matrix - anything like scipy.linalg's pinv2 in IDL? [message #83777 is a reply to message #83776] Wed, 03 April 2013 06:33 Go to previous messageGo to previous message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Tue, 2 Apr 2013 22:18:16 -0700 (PDT), JP wrote:

> Is that an equivalent to the scipy pinv2 i am looking for? And if so, I will appreciate if someone will better algebra skills than me (likely 95% of this community) could suggest how to introduce the rcond keyword available in pinv2.
>
I am very sure, that I am one of the 5%. So be very careful with the
following code. From the description it looks like the scipy function
is doing something like this:

function pinv2,a,rcond=rcond
;
compile_opt defint32,strictarr,logical_predicate
;
svdc,a,w,u,v ; singular value decomposition
;
n=n_elements(w)
threshold=n_elements(rcond)? max(w)*rcond : 0.
ii=where(w gt threshold,count)
if count lt n then begin
message,/info,strtrim(n-count,2)+' small singular values.'
if count le 0 then message,'All singular values are too small.'
end
;
jj=(indgen(n))[ii]*(n+1) ; diagonal elements
matrix=make_array(n,n,type=size(w,/type))
matrix[jj]=1./w[ii]
result=transpose(u)#matrix#v
;
return,result
end

If you want to use double precision, take a look at the IDL function
LA_SVD.

Cheers, Heinz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Problem with logarithmic axes using AXIS IDL command
Next Topic: Re: Vector representation of data.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:21:42 PDT 2025

Total time taken to generate the page: 1.44033 seconds