Registered Member
|
Hello, everyone!
Here is my case: I am working on solving linear equation Ax = b by using Eigen solvers through mex function of Matlab. I have gotten a complex sparse matrix A and a sparse vector b from Matlab workspace. I want to map matrix A and vector b in Eigen sparse matrix format, after that use Eigen's linear equation solvers to solve, at last transfer the results x to Matlab workspace. However, since I am not good at C++ and not familiar with Eigen either. I am stuck at the first step, namely constructing the complex sparse matrix in Eigen accepted format. I have found there is a following function in Eigen,
And I can use mxGetPr, mxGetPi, mxGetIr, mxGetJc, etc, these mex functions to get the info for the above "rows, cols, nnz, row_ptr, col_index, values". However, since in my case, matrix A is a complex sparse matrix. I am not sure whether "MappedSparseMatrix" can do that. If it can, how the format of "MappedSparseMatrix" should be ? Like the following ?
If so, how should I construct that values_complex ? Besides, I have found about a relevant topic before, https://forum.kde.org/viewtopic.php?f=74&t=89083 I can use the following codes to get a complex dense matrix.
However, since my matrix A is a sparse matrix. it seems that it will produce errors if I define mat as a complex sparse matrix like the following:
So can anyone provide some advice for that? Thanks very much for your kindly help! |
Moderator
|
For the record, this thread moved to: http://stackoverflow.com/questions/3986 ... -workspace.
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]