Skip to content

Possibly a bug in linear solve with column major layout? #228

@cxzheng

Description

@cxzheng

Hi, I'm trying to use the package, but found something very puzzling.

The following code from the example in the doc works perfectly:

let a: Array2<f64> = random((3, 3));
let f = a.factorize_into().unwrap(); // LU factorize A (A is consumed)
for _ in 0..3 {
    let b: Array1<f64> = random(3);
    let x = f.solve_into(b).unwrap(); // Solve A * x = b using factorized L, U
}

However, as soon as I change the layout into column (F) major, the code panics:

    let a: Array2<f64> = random((3, 3).f());
    let f = a.factorize_into().unwrap(); // LU factorize A (A is consumed)
    for _ in 0..3 {
        let b: Array1<f64> = random(3);
        let x = f.solve_into(b).unwrap(); // Solve A * x = b using factorized L, U
        println!("x = {:?}", x);
    }

Here the only change is the layout of a (from row major into column major).

Can anyone provide some help if this is a bug or something I didn't fully understand?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug issue, or bug fix change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions