TDecompSVD

Hi all,

I posted this as a bug report but I may just be misunderstanding something…

I need to solve a linear equation systems with much more equations than unknowns, but possibly still underconstrained. A simple example is attached (2 unknowns, and 4 identical equations : macro and output)

I treat this using TDecompSVD, and am trying to extract information telling me whether the linear system is underconstrained or not.

After defining, decomposing and printing the SVD, the output information seems to make no sense :

  • fCondition = -1 ?! (I expect a float >0)
  • kDecomposed = 262144 (I expect a bool)
  • kSingular = 2097152 (I expect a bool)
  • in my example of a 4x2 decomposed matrix, fV should be 2x2 according to documentation; it is 4x2

I couldn’t find any hints in the existing documentation, so any help is welcome.

Thanks,
Maarten
testSVD.txt (1013 Bytes)
testSVD.C (613 Bytes)

Eddy will answer your mail in the coming days

Rene

Hi,

It actually all looks fine, let’s walk through your output:

Since your matrix is singular, no condition number can be determined
and defaults to -1 which is a number that a non-singular matrix can not
have.

You are accessing here two internal status enum’s . This particular
enum will be moved now to a protected area in the class .
If you want to know if a matrix is singular call the TDecompSVD
functions :

  1. virtual void Det (Double_t &d1,Double_t &d2); and check if the
    determinant is zero through d1 (det = d1* 2^d2)
  2. or const TVectorD &GetSig() and check whether any of the singular
    values equals 0 . 1) is of course nothing else than a product of
    all singular values

Both are actually ok :laughing: :

  TDecompSVD svd(A);
  svd.Print();

  Bool_t ok;
  const TVectorD c_svd = svd.Solve(y,ok);
  c_svd.Print();

You request a print of the SVD class components before any
decomposition is performed like through Solve,Decompose,Invert,
Condition… . Initially V is a 4 x 2 matrix and only after the
decomposition gets resized to 2 x 2 . If you move the Print
after the Solve you will get what you expected (plus non-trivial
contents).

Eddy

Thanks Eddy for these clarifications,
Maarten