Registered Member
|
Is there a way to copy the upper triangular part of a sparse martix to the lower part just by calling function without any extra expenses?
Sparse double matrix A and B are symmetrical, and sparse complex matrix C= A*j-B*(1.0+j), where j is imaginary unite. I want to only store upper part of A and B to save memory since the nonezero number of A and B is about 600 thousand. Matrix C is complex which isn't self-adjoint, I cannot only use the upper part of C to calculate. |
Moderator
|
I'm not sure to clearly understand what you want to achieve, but this should help, assuming sym is sparse lower triangular (the upper triangular part is empty), then you can do stuff like:
SparseMatrix<double> full = sym.selfadjointView<Lower>(); SparseMatrix<double> upper = sym.transpose(); SparseMatrix<double> upper2 = full.triangularView<Lower>().transpose(); |
Registered Member
|
Thaks for your attention! I want to copy data from the upper part of a sparse complex matrix and not to get a self adjoint conjugate matrix. so for a sprase double matrix full = sym.selfadjointView<Lower>() will meet expectations. But for a sparse complex matrix, the function can not meet my requirements . I am looking forward your reply again. Thanks. |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]