Armadillo complex sparse matrix inverse
I am writing a program with Armadillo C ++ (4.400.1)
I have a matrix that needs to be sparse and complex and I want to calculate the inverse of such a matrix. Since it is sparse, it can be pseudo-inverse, but I can guarantee that the matrix has a full diagonal.
The Armadillo API documentation mentions a method .i()
for calculating the inverse of any matrix, but the members sp_cx_mat
do not contain such a method, and functions inv()
or pinv()
cannot sp_cx_mat
apparently handle .
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 calculate the inverse of a type matrix sp_cx_mat
.
source to share
The allowed matrix support in Armadillo is not complete, and many of the factorizations / complex operations available for dense matrices are not available for sparse matrices. There are a number of reasons for this, the biggest of which is that efficient complex operations such as factorization for sparse matrices are still a very open area of ββresearch. Thus, the function .i()
is available for cx_sp_mat
or other types sp_mat
. Another reason for this is the lack of time on the part of the sparse matrix developers (... me).
Given that the inverse of a sparse matrix will tend to be dense, then you might just be better off turning yours cx_sp_mat
into cx_mat
and then using the same inversion techniques you would normally use for dense matrices. Since you plan on representing this as a dense matrix anyway, it is a fair assumption that you have enough RAM to do this.
source to share