Reputation: 31
I am trying to program an algorithm in C + +, I use the Eigen library.
The problem is that I need to solve the following equation in C + +:
Find the coefficients: s1,..., sn ∈ R such that a(-1)ψi = s1ψ1 +...+snψn
ψi:
matrices are known.
Upvotes: 2
Views: 4378
Reputation: 29205
Using the notations of your comment, form a vector of unknowns y:=[a,b,c]
, form the right-hand-side vector f
containing the coefficients of the matrix X
as a vector, and similarly form a matrix A
in which the j-th column corresponds to the entries of the matrix Mj
.
At this point you now have to solve an overdetermined problem of the form A*y = f
. Assuming you are looking for a least square solution, you can then read this doc page for all the details on how to use Eigen for this task.
Upvotes: 2