@@ -84,14 +84,14 @@ extern crate openblas_src as _src;
84
84
#[ cfg( any( feature = "netlib-system" , feature = "netlib-static" ) ) ]
85
85
extern crate netlib_src as _src;
86
86
87
- pub mod error;
88
- pub mod flags;
89
- pub mod layout;
90
-
87
+ pub mod alloc;
91
88
pub mod cholesky;
92
89
pub mod eig;
93
90
pub mod eigh;
94
91
pub mod eigh_generalized;
92
+ pub mod error;
93
+ pub mod flags;
94
+ pub mod layout;
95
95
pub mod least_squares;
96
96
pub mod opnorm;
97
97
pub mod qr;
@@ -101,16 +101,12 @@ pub mod solveh;
101
101
pub mod svd;
102
102
pub mod svddc;
103
103
pub mod triangular;
104
+ pub mod tridiagonal;
104
105
105
- mod alloc;
106
- mod tridiagonal;
107
-
108
- pub use self :: cholesky:: * ;
109
106
pub use self :: flags:: * ;
110
107
pub use self :: least_squares:: LeastSquaresOwned ;
111
- pub use self :: opnorm:: * ;
112
108
pub use self :: svd:: { SvdOwned , SvdRef } ;
113
- pub use self :: tridiagonal:: * ;
109
+ pub use self :: tridiagonal:: { LUFactorizedTridiagonal , Tridiagonal } ;
114
110
115
111
use self :: { alloc:: * , error:: * , layout:: * } ;
116
112
use cauchy:: * ;
@@ -120,7 +116,7 @@ pub type Pivot = Vec<i32>;
120
116
121
117
#[ cfg_attr( doc, katexit:: katexit) ]
122
118
/// Trait for primitive types which implements LAPACK subroutines
123
- pub trait Lapack : Tridiagonal_ {
119
+ pub trait Lapack : Scalar {
124
120
/// Compute right eigenvalue and eigenvectors for a general matrix
125
121
fn eig (
126
122
calc_v : bool ,
@@ -306,6 +302,19 @@ pub trait Lapack: Tridiagonal_ {
306
302
a : & [ Self ] ,
307
303
b : & mut [ Self ] ,
308
304
) -> Result < ( ) > ;
305
+
306
+ /// Computes the LU factorization of a tridiagonal `m x n` matrix `a` using
307
+ /// partial pivoting with row interchanges.
308
+ fn lu_tridiagonal ( a : Tridiagonal < Self > ) -> Result < LUFactorizedTridiagonal < Self > > ;
309
+
310
+ fn rcond_tridiagonal ( lu : & LUFactorizedTridiagonal < Self > ) -> Result < Self :: Real > ;
311
+
312
+ fn solve_tridiagonal (
313
+ lu : & LUFactorizedTridiagonal < Self > ,
314
+ bl : MatrixLayout ,
315
+ t : Transpose ,
316
+ b : & mut [ Self ] ,
317
+ ) -> Result < ( ) > ;
309
318
}
310
319
311
320
macro_rules! impl_lapack {
@@ -491,6 +500,28 @@ macro_rules! impl_lapack {
491
500
use triangular:: * ;
492
501
SolveTriangularImpl :: solve_triangular( al, bl, uplo, d, a, b)
493
502
}
503
+
504
+ fn lu_tridiagonal( a: Tridiagonal <Self >) -> Result <LUFactorizedTridiagonal <Self >> {
505
+ use tridiagonal:: * ;
506
+ let work = LuTridiagonalWork :: <$s>:: new( a. l) ;
507
+ work. eval( a)
508
+ }
509
+
510
+ fn rcond_tridiagonal( lu: & LUFactorizedTridiagonal <Self >) -> Result <Self :: Real > {
511
+ use tridiagonal:: * ;
512
+ let mut work = RcondTridiagonalWork :: <$s>:: new( lu. a. l) ;
513
+ work. calc( lu)
514
+ }
515
+
516
+ fn solve_tridiagonal(
517
+ lu: & LUFactorizedTridiagonal <Self >,
518
+ bl: MatrixLayout ,
519
+ t: Transpose ,
520
+ b: & mut [ Self ] ,
521
+ ) -> Result <( ) > {
522
+ use tridiagonal:: * ;
523
+ SolveTridiagonalImpl :: solve_tridiagonal( lu, bl, t, b)
524
+ }
494
525
}
495
526
} ;
496
527
}
0 commit comments