Skip to content

Commit ef1a7e1

Browse files
committed
Re-export struct/enum moved into lax::
1 parent 7151b96 commit ef1a7e1

File tree

2 files changed

+5
-113
lines changed

2 files changed

+5
-113
lines changed

ndarray-linalg/src/svddc.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,7 @@ use super::error::*;
77
use super::layout::*;
88
use super::types::*;
99

10-
/// Specifies how many of the columns of *U* and rows of *V*ᵀ are computed and returned.
11-
///
12-
/// For an input array of shape *m*×*n*, the following are computed:
13-
#[derive(Clone, Copy, Eq, PartialEq)]
14-
#[repr(u8)]
15-
pub enum UVTFlag {
16-
/// All *m* columns of *U* and all *n* rows of *V*ᵀ.
17-
Full = b'A',
18-
/// The first min(*m*,*n*) columns of *U* and the first min(*m*,*n*) rows of *V*ᵀ.
19-
Some = b'S',
20-
/// No columns of *U* or rows of *V*ᵀ.
21-
None = b'N',
22-
}
10+
pub use lapack::svddc::UVTFlag;
2311

2412
/// Singular-value decomposition of matrix (copying) by divide-and-conquer
2513
pub trait SVDDC {

ndarray-linalg/src/tridiagonal.rs

Lines changed: 4 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,15 @@
22
//! &
33
//! Methods for tridiagonal matrices
44
5-
use std::ops::{Index, IndexMut};
6-
7-
use cauchy::Scalar;
8-
use ndarray::*;
9-
use num_traits::One;
10-
115
use super::convert::*;
126
use super::error::*;
137
use super::lapack::*;
148
use super::layout::*;
9+
use cauchy::Scalar;
10+
use ndarray::*;
11+
use num_traits::One;
1512

16-
/// Represents a tridiagonal matrix as 3 one-dimensional vectors.
17-
/// This struct also holds the layout of the raw matrix.
18-
#[derive(Clone, PartialEq)]
19-
pub struct Tridiagonal<A: Scalar> {
20-
/// layout of raw matrix
21-
pub l: MatrixLayout,
22-
/// (n-1) sub-diagonal elements of matrix.
23-
pub dl: Vec<A>,
24-
/// (n) diagonal elements of matrix.
25-
pub d: Vec<A>,
26-
/// (n-1) super-diagonal elements of matrix.
27-
pub du: Vec<A>,
28-
}
29-
30-
pub trait TridiagIndex {
31-
fn to_tuple(&self) -> (i32, i32);
32-
}
33-
impl TridiagIndex for [Ix; 2] {
34-
fn to_tuple(&self) -> (i32, i32) {
35-
(self[0] as i32, self[1] as i32)
36-
}
37-
}
38-
39-
impl<A, I> Index<I> for Tridiagonal<A>
40-
where
41-
A: Scalar,
42-
I: TridiagIndex,
43-
{
44-
type Output = A;
45-
#[inline]
46-
fn index(&self, index: I) -> &A {
47-
let (n, _) = self.l.size();
48-
let (row, col) = index.to_tuple();
49-
assert!(
50-
std::cmp::max(row, col) < n,
51-
"ndarray: index {:?} is out of bounds for array of shape {}",
52-
[row, col],
53-
n
54-
);
55-
match row - col {
56-
0 => &self.d[row as usize],
57-
1 => &self.dl[col as usize],
58-
-1 => &self.du[row as usize],
59-
_ => panic!(
60-
"ndarray-linalg::tridiagonal: index {:?} is not tridiagonal element",
61-
[row, col]
62-
),
63-
}
64-
}
65-
}
66-
67-
impl<A, I> IndexMut<I> for Tridiagonal<A>
68-
where
69-
A: Scalar,
70-
I: TridiagIndex,
71-
{
72-
#[inline]
73-
fn index_mut(&mut self, index: I) -> &mut A {
74-
let (n, _) = self.l.size();
75-
let (row, col) = index.to_tuple();
76-
assert!(
77-
std::cmp::max(row, col) < n,
78-
"ndarray: index {:?} is out of bounds for array of shape {}",
79-
[row, col],
80-
n
81-
);
82-
match row - col {
83-
0 => &mut self.d[row as usize],
84-
1 => &mut self.dl[col as usize],
85-
-1 => &mut self.du[row as usize],
86-
_ => panic!(
87-
"ndarray-linalg::tridiagonal: index {:?} is not tridiagonal element",
88-
[row, col]
89-
),
90-
}
91-
}
92-
}
13+
pub use lapack::tridiagonal::{LUFactorizedTridiagonal, Tridiagonal};
9314

9415
/// An interface for making a Tridiagonal struct.
9516
pub trait ExtractTridiagonal<A: Scalar> {
@@ -188,23 +109,6 @@ pub trait SolveTridiagonalInplace<A: Scalar, D: Dimension> {
188109
) -> Result<&'a mut ArrayBase<S, D>>;
189110
}
190111

191-
/// Represents the LU factorization of a tridiagonal matrix `A` as `A = P*L*U`.
192-
#[derive(Clone)]
193-
pub struct LUFactorizedTridiagonal<A: Scalar> {
194-
/// A tridiagonal matrix which consists of
195-
/// - l : layout of raw matrix
196-
/// - dl: (n-1) multipliers that define the matrix L.
197-
/// - d : (n) diagonal elements of the upper triangular matrix U.
198-
/// - du: (n-1) elements of the first super-diagonal of U.
199-
pub a: Tridiagonal<A>,
200-
/// (n-2) elements of the second super-diagonal of U.
201-
pub du2: Vec<A>,
202-
/// 1-norm of raw matrix (used in .rcond_tridiagonal()).
203-
pub anom: A::Real,
204-
/// The pivot indices that define the permutation matrix `P`.
205-
pub ipiv: Pivot,
206-
}
207-
208112
impl<A> SolveTridiagonal<A, Ix2> for LUFactorizedTridiagonal<A>
209113
where
210114
A: Scalar + Lapack,

0 commit comments

Comments
 (0)