I'm writing a program with Armadillo C++ (4.400.1)
I have a matrix that has to be sparse and complex, and I want to calculate the inverse of such matrix. Since it is sparse it could be the pseudoinverse, but I can guarantee that the matrix has the full diagonal.
In the API documentation of Armadillo, it mentions the method .i()
to calculate the inverse of any matrix, but sp_cx_mat
members do not contain such method, and the inv()
or pinv()
functions cannot handle the sp_cx_mat
type apparently.
sp_cx_mat Y;
/*Fill Y ensuring that the diagonal is full*/
sp_cx_mat Z = Y.i();
or
sp_cx_mat Z = inv(Y);
None of them work.
I would like to know how to compute the inverse of matrices of sp_cx_mat
type.
U S V == Y
, thenY.pinv() == U S.pinv() V
. Because the Y is of full-rank (because of that diagonal)Armadillo::svd_econ()
doesn't make sense. So, computing the SVD will be significantly slower than other methods for solving the pseodo-inverse. – Unapiedra