@@ -24,17 +24,29 @@ macro_rules! impl_cholesky {
24
24
impl Cholesky_ for $scalar {
25
25
fn cholesky( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] ) -> Result <( ) > {
26
26
let ( n, _) = l. size( ) ;
27
+ let mut info = 0 ;
28
+ let uplo = match l {
29
+ MatrixLayout :: F { .. } => uplo,
30
+ MatrixLayout :: C { .. } => uplo. t( ) ,
31
+ } ;
27
32
unsafe {
28
- $trf( l . lapacke_layout ( ) , uplo as u8 , n, a, n) . as_lapack_result ( ) ? ;
33
+ $trf( uplo as u8 , n, a, n, & mut info ) ;
29
34
}
35
+ info. as_lapack_result( ) ?;
30
36
Ok ( ( ) )
31
37
}
32
38
33
39
fn inv_cholesky( l: MatrixLayout , uplo: UPLO , a: & mut [ Self ] ) -> Result <( ) > {
34
40
let ( n, _) = l. size( ) ;
41
+ let mut info = 0 ;
42
+ let uplo = match l {
43
+ MatrixLayout :: F { .. } => uplo,
44
+ MatrixLayout :: C { .. } => uplo. t( ) ,
45
+ } ;
35
46
unsafe {
36
- $tri( l . lapacke_layout ( ) , uplo as u8 , n, a, l. lda( ) ) . as_lapack_result ( ) ? ;
47
+ $tri( uplo as u8 , n, a, l. lda( ) , & mut info ) ;
37
48
}
49
+ info. as_lapack_result( ) ?;
38
50
Ok ( ( ) )
39
51
}
40
52
@@ -46,18 +58,22 @@ macro_rules! impl_cholesky {
46
58
) -> Result <( ) > {
47
59
let ( n, _) = l. size( ) ;
48
60
let nrhs = 1 ;
49
- let ldb = 1 ;
61
+ let uplo = match l {
62
+ MatrixLayout :: F { .. } => uplo,
63
+ MatrixLayout :: C { .. } => uplo. t( ) ,
64
+ } ;
65
+ let mut info = 0 ;
50
66
unsafe {
51
- $trs( l. lapacke_layout( ) , uplo as u8 , n, nrhs, a, l. lda( ) , b, ldb)
52
- . as_lapack_result( ) ?;
67
+ $trs( uplo as u8 , n, nrhs, a, l. lda( ) , b, n, & mut info) ;
53
68
}
69
+ info. as_lapack_result( ) ?;
54
70
Ok ( ( ) )
55
71
}
56
72
}
57
73
} ;
58
74
} // end macro_rules
59
75
60
- impl_cholesky ! ( f64 , lapacke :: dpotrf, lapacke :: dpotri, lapacke :: dpotrs) ;
61
- impl_cholesky ! ( f32 , lapacke :: spotrf, lapacke :: spotri, lapacke :: spotrs) ;
62
- impl_cholesky ! ( c64, lapacke :: zpotrf, lapacke :: zpotri, lapacke :: zpotrs) ;
63
- impl_cholesky ! ( c32, lapacke :: cpotrf, lapacke :: cpotri, lapacke :: cpotrs) ;
76
+ impl_cholesky ! ( f64 , lapack :: dpotrf, lapack :: dpotri, lapack :: dpotrs) ;
77
+ impl_cholesky ! ( f32 , lapack :: spotrf, lapack :: spotri, lapack :: spotrs) ;
78
+ impl_cholesky ! ( c64, lapack :: zpotrf, lapack :: zpotri, lapack :: zpotrs) ;
79
+ impl_cholesky ! ( c32, lapack :: cpotrf, lapack :: cpotri, lapack :: cpotrs) ;
0 commit comments