/// Solve full eigenvalue problem, sort by `order` and truncate to `size`
Solve full eigenvalue problem, sort by `order` and truncate to `size`
Solve full eigenvalue problem sort by ` order ` and truncate to ` size `
fn sorted_eig<S: Data<Elem = A>, A: Scalar + Lapack>(
    a: ArrayBase<S, Ix2>,
    b: Option<ArrayBase<S, Ix2>>,
    size: usize,
    order: &Order,
) -> Result<(Array1<A>, Array2<A>)> {
    let n = a.len_of(Axis(0));
    let (vals, vecs) = match b {
        Some(b) => (a, b).eigh(UPLO::Upper).map(|x| (x.0, (x.1).0))?,
        _ => a.eigh(UPLO::Upper)?,
    };
    Ok(match order {
        Order::Largest => (
            vals.slice_move(s![n-size..; -1]).mapv(Scalar::from_real),
            vecs.slice_move(s![.., n-size..; -1]),
        ),
        Order::Smallest => (
            vals.slice_move(s![..size]).mapv(Scalar::from_real),
            vecs.slice_move(s![.., ..size]),
        ),
    })
}
fn sorted_eig < S : Data < Elem = A > , A : Scalar + Lapack > ( a : ArrayBase < S , Ix2 > , b : Option < ArrayBase < S , Ix2 > > , size : usize , order : & Order , ) -> Result < ( Array1 < A > , Array2 < A > ) > { let n = a . len_of ( Axis ( 0 ) ) ; let ( vals , vecs ) = match b { Some ( b ) => ( a , b ) . eigh ( UPLO :: Upper ) . map ( | x | ( x . 0 , ( x . 1 ) . 0 ) ) ? , _ => a . eigh ( UPLO :: Upper ) ? , } ; Ok ( match order { Order :: Largest => ( vals . slice_move ( s ! [ n size 1 ] ) . mapv ( Scalar :: from_real ) , vecs . slice_move ( s ! [ n size 1 ] ) , ) , Order :: Smallest => ( vals . slice_move ( s ! [ size ] ) . mapv ( Scalar :: from_real ) , vecs . slice_move ( s ! [ size ] ) , ) , } ) }
Solve full eigenvalue problem, sort by `order` and truncate to `size`
Solve full eigenvalue problem sort by ` order ` and truncate to ` size `
a
ArrayBase<S, Ix2>
b
Option<ArrayBase<S, Ix2>>
size
usize
order
&Order