Pseudo inverse (SVD) of a singular complex square matrix in C/C++ -
singular complex matrix 2n x 2n n 3; 4 or 5. how calculate singular value decomposition in c/c++?
input matrix r in form y*y' ()' transjugate.
eigenvectors in u main output. consider following matlab code:
[u,d,v]=svd(r); en=u(:,n+1:m); % first few eigenvectors out enen = en*en';
most of c/c++ libraries (e.g. opencv) support matrix inversion , svd real matrices. in non-singular case
r = re(r) + j*im(r)
resolution helps. upper half of inverted
[re(r) -im(r); im(r) re(r)]
gives r-1 when complex. numerical method key here, many suggested armadillo , eigen instead of implementing custom error prone solution.
what think? choice , why?
let a
matrix , a*
conjugate transpose. matrix a.a*
hermitian. positive semi-definite https://en.wikipedia.org/wiki/conjugate_transpose
in case, there no fundamental difference between svd , eigenvalue decomposition. http://cims.nyu.edu/~donev/teaching/nmi-fall2010/lecture5.handout.pdf
hence, routines of lapack can prove useful zheevd()
, zheev()
.
you can call these function c lapacke interface. these functions wrapped libraries armadillo , eigen c++.
take @ answer of mine example of how call these functions using lapacke: low ram consuming c++ eigen solver .
Comments
Post a Comment