@@ -6,7 +6,7 @@ use error::*;
66use layout:: MatrixLayout ;
77use types:: * ;
88
9- use super :: { UPLO , into_result } ;
9+ use super :: { into_result , UPLO } ;
1010
1111pub trait Cholesky_ : Sized {
1212 /// Cholesky: wrapper of `*potrf`
@@ -23,28 +23,29 @@ pub trait Cholesky_: Sized {
2323
2424macro_rules! impl_cholesky {
2525 ( $scalar: ty, $trf: path, $tri: path, $trs: path) => {
26- impl Cholesky_ for $scalar {
27- unsafe fn cholesky( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] ) -> Result <( ) > {
28- let ( n, _) = l. size( ) ;
29- let info = $trf( l. lapacke_layout( ) , uplo as u8 , n, a, n) ;
30- into_result( info, ( ) )
31- }
32-
33- unsafe fn inv_cholesky( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] ) -> Result <( ) > {
34- let ( n, _) = l. size( ) ;
35- let info = $tri( l. lapacke_layout( ) , uplo as u8 , n, a, l. lda( ) ) ;
36- into_result( info, ( ) )
37- }
38-
39- unsafe fn solve_cholesky( l: MatrixLayout , uplo: UPLO , a: & [ Self ] , b: & mut [ Self ] ) -> Result <( ) > {
40- let ( n, _) = l. size( ) ;
41- let nrhs = 1 ;
42- let ldb = 1 ;
43- let info = $trs( l. lapacke_layout( ) , uplo as u8 , n, nrhs, a, l. lda( ) , b, ldb) ;
44- into_result( info, ( ) )
45- }
46- }
47- } } // end macro_rules
26+ impl Cholesky_ for $scalar {
27+ unsafe fn cholesky( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] ) -> Result <( ) > {
28+ let ( n, _) = l. size( ) ;
29+ let info = $trf( l. lapacke_layout( ) , uplo as u8 , n, a, n) ;
30+ into_result( info, ( ) )
31+ }
32+
33+ unsafe fn inv_cholesky( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] ) -> Result <( ) > {
34+ let ( n, _) = l. size( ) ;
35+ let info = $tri( l. lapacke_layout( ) , uplo as u8 , n, a, l. lda( ) ) ;
36+ into_result( info, ( ) )
37+ }
38+
39+ unsafe fn solve_cholesky( l: MatrixLayout , uplo: UPLO , a: & [ Self ] , b: & mut [ Self ] ) -> Result <( ) > {
40+ let ( n, _) = l. size( ) ;
41+ let nrhs = 1 ;
42+ let ldb = 1 ;
43+ let info = $trs( l. lapacke_layout( ) , uplo as u8 , n, nrhs, a, l. lda( ) , b, ldb) ;
44+ into_result( info, ( ) )
45+ }
46+ }
47+ } ;
48+ } // end macro_rules
4849
4950impl_cholesky ! ( f64 , lapacke:: dpotrf, lapacke:: dpotri, lapacke:: dpotrs) ;
5051impl_cholesky ! ( f32 , lapacke:: spotrf, lapacke:: spotri, lapacke:: spotrs) ;
0 commit comments