lsolve

Function lsolve 

Source
pub fn lsolve<T: Numeric<T>>(l: &Sprs<T>, x: &mut [T])
Expand description

Solves a lower triangular system. Solves Lx=b. Where x and b are dense.

The lsolve function assumes that the diagonal entry of L is always present and is the first entry in each column. Otherwise, the row indices in each column of L can appear in any order.

On input, X contains the right hand side, and on output, the solution.

ยงExample:

let l = [
    vec![1.0000,  0.,      0.,       0.,       0.,       0.,       0.,       0.,       0.,       0.],
    vec![0.4044,  1.0000,  0.,       0.,       0.,       0.,       0.,       0.,       0.,       0.],
    vec![0.3465,  0.0122,  1.0000,   0.,       0.,       0.,       0.,       0.,       0.,       0.],
    vec![0.7592, -0.3591, -0.1154,   1.0000,   0.,       0.,       0.,       0.,       0.,       0.],
    vec![0.6868,  0.1135,  0.2113,   0.6470,   1.0000,   0.,       0.,       0.,       0.,       0.],
    vec![0.7304, -0.1453,  0.1755,   0.0585,  -0.7586,   1.0000,   0.,       0.,       0.,       0.],
    vec![0.8362,  0.0732,  0.7601,  -0.1107,   0.1175,  -0.5406,   1.0000,   0.,       0.,       0.],
    vec![0.0390,  0.8993,  0.3428,   0.1639,   0.4246,  -0.5861,   0.7790,   1.0000,   0.,       0.],
    vec![0.8079, -0.4437,  0.8271,   0.2583,  -0.2238,   0.0544,   0.2360,  -0.7387,   1.0000,   0.],
    vec![0.1360,  0.9532, -0.1212,  -0.1943,   0.4311,   0.1069,   0.3717,   0.7176,  -0.6053,   1.0000]
];
let mut l_sparse = rsparse::data::Sprs::new();
l_sparse.from_vec(&l);

let mut b = [
    0.8568,
    0.3219,
    0.9263,
    0.4635,
    0.8348,
    0.1339,
    0.8444,
    0.7000,
    0.7947,
    0.5552
];

rsparse::lsolve(&l_sparse, &mut b);