Can I solve a system of linear equations in the form xA=b using Eigen, with A being sparse?

StackOverflow https://stackoverflow.com/questions/19235629

  •  30-06-2022
  •  | 
  •  

Question

I need to convert my MATLAB code to C++, which include linear equations in the form xA=0.

I know that Eigen can deal linear equations Ax=b. I am asking: is there a way to solve a system of linear equations xA=b, using Eigen for C++ (Visual Studio 2010), with A being a sparse matrix? If not, what library can I use?

Thank you for any help.

Was it helpful?

Solution

x*A = b is equivalent to A.transpose() * z = b.transpose(); x = z.transpose() which can be solved for x.

Note, that storage operations are cheap in comparison to the solving of the linear system. A is sparse and the sparsity remains the same for the transpose operation. Often, transposition is just a flag and a change in the addressing of the elements. From my first glance into the doc this does not apply to Eigen. But, from what I told you before, this does not matter so much.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top