pub fn ldl_symbolic<N, I, PStorage>(mat: CsMatViewI<N, I>,
                                    perm: &Permutation<I, PStorage>,
                                    l_colptr: &mut [I],
                                    mut parents: linalg::etree::ParentsViewMut,
                                    l_nz: &mut [I],
                                    flag_workspace: &mut [I],
                                    check_symmetry: SymmetryCheck)
where N: Clone + Copy + PartialEq,
      I: SpIndex,
      PStorage: Deref<Target = [I]>
{

    match check_symmetry {
        SymmetryCheck::DontCheckSymmetry => (),
        SymmetryCheck::CheckSymmetry => {
            if !is_symmetric(&mat) {
                panic!("Matrix is not symmetric")
            }
        }
    }

    let n = mat.rows();

    let outer_it = mat.outer_iterator_perm(perm.view());
    // compute the elimination tree of L
    for (k, (_, vec)) in outer_it.enumerate() {

        flag_workspace[k] = I::from_usize(k); // this node is visited
        parents.set_root(k);
        l_nz[k] = I::zero();

        for (inner_ind, _) in vec.iter_perm(perm.inv()) {
            let mut i = inner_ind;

            if i < k {
                while flag_workspace[i].index() != k {
                    parents.uproot(i, k);
                    l_nz[i] += I::one();
                    flag_workspace[i] = I::from_usize(k);
                    i = parents.get_parent(i).expect("uprooted so not a root");
                }
            }
        }
    }

    let mut prev = I::zero();
    for (k, colptr) in (0..n).zip(l_colptr.iter_mut()) {
        *colptr = prev;
        prev += l_nz[k];
    }
    l_colptr[n] = prev;

}
/// Perform a symbolic LDLt decomposition of a symmetric sparse matrix
Perform a symbolic LDLt decomposition of a symmetric sparse matrix
Perform a symbolic LDLt decomposition of a symmetric sparse matrix
pub fn ldl_symbolic<N, I, PStorage>(mat: CsMatViewI<N, I>,
                                    perm: &Permutation<I, PStorage>,
                                    l_colptr: &mut [I],
                                    mut parents: linalg::etree::ParentsViewMut,
                                    l_nz: &mut [I],
                                    flag_workspace: &mut [I],
                                    check_symmetry: SymmetryCheck)
where N: Clone + Copy + PartialEq,
      I: SpIndex,
      PStorage: Deref<Target = [I]>
{
    match check_symmetry {
        SymmetryCheck::DontCheckSymmetry => (),
        SymmetryCheck::CheckSymmetry => {
            if !is_symmetric(&mat) {
                panic!("Matrix is not symmetric")
            }
        }
    }
    let n = mat.rows();
    let outer_it = mat.outer_iterator_perm(perm.view());
    // compute the elimination tree of L
    for (k, (_, vec)) in outer_it.enumerate() {
        flag_workspace[k] = I::from_usize(k); // this node is visited
        parents.set_root(k);
        l_nz[k] = I::zero();
        for (inner_ind, _) in vec.iter_perm(perm.inv()) {
            let mut i = inner_ind;
            if i < k {
                while flag_workspace[i].index() != k {
                    parents.uproot(i, k);
                    l_nz[i] += I::one();
                    flag_workspace[i] = I::from_usize(k);
                    i = parents.get_parent(i).expect("uprooted so not a root");
                }
            }
        }
    }
    let mut prev = I::zero();
    for (k, colptr) in (0..n).zip(l_colptr.iter_mut()) {
        *colptr = prev;
        prev += l_nz[k];
    }
    l_colptr[n] = prev;
}
pub fn ldl_symbolic < N , I , PStorage > ( mat : CsMatViewI < N , I > , perm : & Permutation < I , PStorage > , l_colptr : & mut [ I ] , mut parents : linalg :: etree :: ParentsViewMut , l_nz : & mut [ I ] , flag_workspace : & mut [ I ] , check_symmetry : SymmetryCheck ) where N : Clone + Copy + PartialEq , I : SpIndex , PStorage : Deref < Target = [ I ] > { match check_symmetry { SymmetryCheck :: DontCheckSymmetry => ( ) , SymmetryCheck :: CheckSymmetry => { if ! is_symmetric ( & mat ) { panic ! ( " " ) } } } let n = mat . rows ( ) ; let outer_it = mat . outer_iterator_perm ( perm . view ( ) ) ; // compute the elimination tree of L for ( k , ( _ , vec ) ) in outer_it . enumerate ( ) { flag_workspace [ k ] = I :: from_usize ( k ) ; // this node is visited parents . set_root ( k ) ; l_nz [ k ] = I :: zero ( ) ; for ( inner_ind , _ ) in vec . iter_perm ( perm . inv ( ) ) { let mut i = inner_ind ; if i < k { while flag_workspace [ i ] . index ( ) != k { parents . uproot ( i , k ) ; l_nz [ i ] += I :: one ( ) ; flag_workspace [ i ] = I :: from_usize ( k ) ; i = parents . get_parent ( i ) . expect ( " " ) ; } } } } let mut prev = I :: zero ( ) ; for ( k , colptr ) in ( 0 .. n ) . zip ( l_colptr . iter_mut ( ) ) { * colptr = prev ; prev += l_nz [ k ] ; } l_colptr [ n ] = prev ; }
Perform a symbolic LDLt decomposition of a symmetric sparse matrix
Perform a symbolic LDLt decomposition of a symmetric sparse matrix
mat
CsMatViewI<N, I>
perm
&Permutation<I, PStorage>
l_colptr
&mut [I]
parents
linalg::etree::ParentsViewMut
l_nz
&mut [I]
flag_workspace
&mut [I]
check_symmetry
SymmetryCheck
mat
CsMatViewI<N, I>
perm
&Permutation<I, PStorage>
l_colptr
&mut [I]
parents
linalg::etree::ParentsViewMut
l_nz
&mut [I]
flag_workspace
&mut [I]
check_symmetry
SymmetryCheck