Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dense solve with Method::Lanczos is segfaulting #198

Open
Breush opened this issue Apr 10, 2019 · 0 comments
Open

Dense solve with Method::Lanczos is segfaulting #198

Breush opened this issue Apr 10, 2019 · 0 comments

Comments

@Breush
Copy link
Contributor

Breush commented Apr 10, 2019

#include <linbox/solutions/solve.h>

using namespace LinBox;

int main(void)
{
    using Field = Givaro::Modular<double>;
    using Matrix = DenseMatrix<Field>;
    using Vector = DenseVector<Field>;

    Field F(101);

    Matrix A(F, 1, 2);
    Vector x(F, A.coldim());
    Vector b(F, A.rowdim());

    A.setEntry(0, 0, 13);
    A.setEntry(0, 1, 27);
    F.assign(b[0], 52);

    // Calling Lanczos
    Method::Lanczos method;
    solve(x, A, b, method);

    std::cout << "[ " << A.getEntry(0, 0) << " " << A.getEntry(0, 1) << " ] x = [ " << b[0] << " ]";
    std::cout << " => x = [ " << x[0] << " " << x[1] << " ]" << std::endl;

    Field::Element Ax0, Ax1, Ax;
    F.mul(Ax0, A.getEntry(0, 0), x[0]);
    F.mul(Ax1, A.getEntry(0, 1), x[1]);
    F.add(Ax, Ax0, Ax1);
    if (!F.areEqual(Ax, b[0])) {
        std::cerr << "PROBLEM! Ax != b" << std::endl;
    }

    return 0;
}

Sparse Lanczos seems ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant