#linear-algebra #matrix-operations #ndarray #interface #high-level #super-lu #sprs

sprs-superlu

The package provides a high level interface between SuperLU, sprs and ndarray

7 releases

new 0.1.6 Oct 15, 2024
0.1.5 Apr 16, 2024
0.1.4 Jan 30, 2024

#776 in Math

Download history 12/week @ 2024-06-27 24/week @ 2024-07-04 19/week @ 2024-07-11 14/week @ 2024-07-18 59/week @ 2024-07-25 22/week @ 2024-08-01 6/week @ 2024-08-08 1/week @ 2024-08-22 16/week @ 2024-08-29 27/week @ 2024-09-05 44/week @ 2024-09-12 52/week @ 2024-09-19 109/week @ 2024-09-26 72/week @ 2024-10-03 130/week @ 2024-10-10

372 downloads per month

MIT license

25KB
632 lines

SuperLU

A Rust interface for SuperLU, utilizing ndarray and sprs for matrix operations.

Example Usage

use std::time::Duration;
use ndarray::arr1;
use sprs::CsMat;
use crate::{Options, solve_super_lu};

fn main() {
    let values = vec![
        19.0, 12.0, 12.0, 21.0, 12.0, 12.0, 21.0, 16.0, 21.0, 5.0, 21.0, 18.0,
    ];
    let row_indices = vec![0, 1, 4, 1, 2, 4, 0, 2, 0, 3, 3, 4];
    let col_ptrs = vec![0, 3, 6, 8, 10, 12];
    let a_mat = CsMat::new_csc((5, 5), col_ptrs, row_indices, values);
    let rhs_1 = arr1(&[1., 1., 1., 1., 1.]);
    let rhs_2 = arr1(&[2., 2., 2., 2., 2.]);
    let b_mat = vec![rhs_1, rhs_2];
    let mut options = Options::default();
    let res = solve_super_lu(a_mat, &b_mat, Some(Duration::from_secs(60)), &mut options);
    let x_1 = res[0];
    let x_2 = res[1];
    println!("A x_1 = rhs_1 -> x_1 =:\n{:?}", x_1);
    println!("A x_2 = rhs_2 -> x_2 =:\n{:?}", x_2);
}

Dependencies

~5.5–7.5MB
~143K SLoC