linbox-team / linbox

LinBox - C++ library for exact, high-performance linear algebra
https://linbox-team.github.io/linbox
GNU Lesser General Public License v2.1
83 stars 28 forks source link

Singular dense solve with Method::Dixon with SolutionType::Determinist fails #189

Closed Breush closed 5 years ago

Breush commented 5 years ago

With this minimal example, we get x = [ 0 0 0 ] as a solution, which is wrong.

#include <linbox/solutions/solve.h>

using namespace LinBox;

int main(void)
{
    using Ring = Givaro::ZRing<Integer>;
    using Matrix = DenseMatrix<Ring>;
    using Vector = DenseVector<Ring>;

    Ring ZZ;

    Matrix A(ZZ, 1, 3);
    Vector x(ZZ, A.coldim());
    Vector b(ZZ, A.rowdim());
    Ring::Element d;

    A.setEntry(0, 1, 1);
    A.setEntry(0, 2, 2);
    ZZ.assign(b[0], 1);

    // Calling Dixon
    solve(x, d, A, b, Method::Dixon(Method::Dixon::SolutionType::DETERMINIST));

    std::cout << "[ 0 1 2 ] x = [ 1 ] => xNum/xDen = [ " << x[0] << " " << x[1] << " " << x[2] << " ] /" << d << std::endl;

    return 0;
}

First investigation shows that FFPACK::LQUPtoInverseOfFullRankMinor within RationalSolver<...>::monolithicSolve might be the culprit.

bdsaunders commented 5 years ago

I'd like to see "determinist" spelled "deterministic". The former word, "one who determines" is seldom used and is jarring to the ear in our context.

On Fri, Mar 8, 2019 at 5:50 AM A. Breust notifications@github.com wrote:

With this minimal example, we get x = [ 0 0 0 ] as a solution, which is wrong.

include <linbox/solutions/solve.h>

using namespace LinBox; int main(void) { using Ring = Givaro::ZRing; using Matrix = DenseMatrix; using Vector = DenseVector;

Ring ZZ;

Matrix A(ZZ, 1, 3);
Vector x(ZZ, A.coldim());
Vector b(ZZ, A.rowdim());
Ring::Element d;

A.setEntry(0, 1, 1);
A.setEntry(0, 2, 2);
ZZ.assign(b[0], 1);

// Calling Dixon
solve(x, d, A, b, Method::Dixon(Method::Dixon::SolutionType::DETERMINIST));

std::cout << "[ 0 1 2 ] x = [ 1 ] => xNum/xDen = [ " << x[0] << " " << x[1] << " " << x[2] << " ] /" << d << std::endl;

return 0;

}

First investigation shows that FFPACK::LQUPtoInverseOfFullRankMinor within RationalSolver<...>::monolithicSolve might be the culprit.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/linbox-team/linbox/issues/189, or mute the thread https://github.com/notifications/unsubscribe-auth/ADk6I51RgOPw3MFxxtoTVfQkKg50CSMHks5vUkBlgaJpZM4blHpV .

Breush commented 5 years ago

@bdsaunders All right, I changed "Determinist" to "Deterministic" in my WIP branch #169.

jgdumas commented 5 years ago

Solved by fflas-ffpack PR#230