Hello,
I’m trying to solve a set of linear equations Ax = b, and I’m surprised that TDecompSVD::Solve() returns true although the set has no solution.
Here is a sample:
[code]void test()
{
TMatrixD A(3, 2);
A(0, 0) = 1; A(0, 1) = 3;
A(1, 0) = 2; A(1, 1) = 2;
A(2, 0) = 3; A(2, 1) = 1;
TVectorD b1(3), b2(3);
b1(0) = -2; b1(1) = 0; b1(2) = 2; // to have a solution
b2(0) = -2; b2(1) = 0; b2(2) = 1; // NOT to have a solution
TDecompSVD svd(A);
printf("solving with b1: %i\n", svd.Solve(b1));
b1.Print();
printf("solving with b2: %i\n", svd.Solve(b2));
b2.Print();
}[/code]
Is there an other (direct) way to check whether the set has a (unique) solution?
Cheers, Kaspi.