How to solve the problem with hint “Error in <UnknownClass::Solve(TVectorD &>: vector and matrix incompatible”

I use linear algebra in root to solve equations, the code file is in the attachment,
when implementing the projection, the error occurs:

Error in <UnknownClass::Solve(TVectorD &>: vector and matrix incompatible

how should I do?

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.24/04
Platform: Ubuntu 20.04
Compiler: GCC 9.3.0

May be @moneta can help.

sorry, forgot to upload my root code file.

MatrixDecomposition.cpp (821 Bytes)

You need to create a TVector with the lower bound 0 (i.e. with indices [0,… ,N-1] otherwise it will not be compatible with the previously created matrix.
So the code to create the TVectorD should be:

TVectorD b(0,2,10.,12.,19.,"END");



it seems the result of the equations solving is not correct, the result shauld be (8,1,1), but the vector b is still (10,12,19), here is the result:

here is the root code:
MatrixDecomposition.cpp (821 Bytes)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.