Skip to content

Commit c2095c9

Browse files
authored
Merge pull request #242 from rust-ndarray/lax-submod-private
Remove ndarray_linalg::lapack alias, make lax submodule private
2 parents b58c8a0 + 2c5189d commit c2095c9

19 files changed

+46
-42
lines changed

lax/src/lib.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,22 @@ extern crate openblas_src as _src;
6868
#[cfg(any(feature = "netlib-system", feature = "netlib-static"))]
6969
extern crate netlib_src as _src;
7070

71-
pub mod cholesky;
72-
pub mod eig;
73-
pub mod eigh;
7471
pub mod error;
7572
pub mod layout;
76-
pub mod least_squares;
77-
pub mod opnorm;
78-
pub mod qr;
79-
pub mod rcond;
80-
pub mod solve;
81-
pub mod solveh;
82-
pub mod svd;
83-
pub mod svddc;
84-
pub mod triangular;
85-
pub mod tridiagonal;
73+
74+
mod cholesky;
75+
mod eig;
76+
mod eigh;
77+
mod least_squares;
78+
mod opnorm;
79+
mod qr;
80+
mod rcond;
81+
mod solve;
82+
mod solveh;
83+
mod svd;
84+
mod svddc;
85+
mod triangular;
86+
mod tridiagonal;
8687

8788
pub use self::cholesky::*;
8889
pub use self::eig::*;
@@ -159,7 +160,7 @@ pub enum NormType {
159160
}
160161

161162
impl NormType {
162-
pub(crate) fn transpose(self) -> Self {
163+
pub fn transpose(self) -> Self {
163164
match self {
164165
NormType::One => NormType::Infinity,
165166
NormType::Infinity => NormType::One,

lax/src/opnorm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
//! Operator norms of matrices
22
3+
use super::NormType;
34
use crate::layout::MatrixLayout;
45
use cauchy::*;
56
use num_traits::Zero;
67

7-
pub use super::NormType;
8-
98
pub trait OperatorNorm_: Scalar {
109
fn opnorm(t: NormType, l: MatrixLayout, a: &[Self]) -> Self::Real;
1110
}

ndarray-linalg/src/cholesky.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use crate::layout::*;
5252
use crate::triangular::IntoTriangular;
5353
use crate::types::*;
5454

55-
pub use crate::lapack::UPLO;
55+
pub use lax::UPLO;
5656

5757
/// Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
5858
pub struct CholeskyFactorized<S: Data> {

ndarray-linalg/src/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! utilities for convert array
22
3+
use lax::UPLO;
34
use ndarray::*;
45

56
use super::error::*;
6-
use super::lapack::UPLO;
77
use super::layout::*;
88
use super::types::*;
99

ndarray-linalg/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum LinalgError {
1414

1515
/// LAPACK subroutine returns non-zero code
1616
#[error(transparent)]
17-
Lapack(#[from] lapack::error::Error),
17+
Lapack(#[from] lax::error::Error),
1818

1919
/// Strides of the array is not supported
2020
#[error("invalid stride: s0={}, s1={}", s0, s1)]

ndarray-linalg/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use super::error::*;
44
use ndarray::*;
55

6-
pub use lapack::layout::MatrixLayout;
6+
pub use lax::layout::MatrixLayout;
77

88
pub trait AllocatedArray {
99
type Elem;

ndarray-linalg/src/least_squares.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
//! // `a` and `b` have been moved, no longer valid
6161
//! ```
6262
63+
use lax::*;
6364
use ndarray::*;
6465

6566
use crate::error::*;
66-
use crate::lapack::least_squares::*;
6767
use crate::layout::*;
6868
use crate::types::*;
6969

@@ -253,7 +253,7 @@ where
253253
/// valid representation for `ArrayBase`.
254254
impl<E, D> LeastSquaresSvdInPlace<D, E, Ix1> for ArrayBase<D, Ix2>
255255
where
256-
E: Scalar + Lapack + LeastSquaresSvdDivideConquer_,
256+
E: Scalar + Lapack,
257257
D: DataMut<Elem = E>,
258258
{
259259
/// Solve a least squares problem of the form `Ax = rhs`

ndarray-linalg/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747

4848
#[macro_use]
4949
extern crate ndarray;
50-
extern crate lax as lapack;
5150

5251
pub mod assert;
5352
pub mod cholesky;

ndarray-linalg/src/lobpcg/eig.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use super::lobpcg::{lobpcg, LobpcgResult, Order};
2-
use crate::{generate, Lapack, Scalar};
2+
use crate::{generate, Scalar};
3+
use lax::Lapack;
4+
35
///! Implements truncated eigenvalue decomposition
46
///
57
use ndarray::prelude::*;

ndarray-linalg/src/lobpcg/lobpcg.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
///which can be used as a solver for large symmetric positive definite eigenproblems.
55
use crate::error::{LinalgError, Result};
66
use crate::{cholesky::*, close_l2, eigh::*, norm::*, triangular::*};
7-
use crate::{Lapack, Scalar};
7+
use cauchy::Scalar;
8+
use lax::Lapack;
89
use ndarray::prelude::*;
910
use ndarray::{Data, OwnedRepr, ScalarOperand};
1011
use num_traits::{Float, NumCast};
@@ -338,7 +339,7 @@ pub fn lobpcg<
338339
let result = p_ap
339340
.as_ref()
340341
.ok_or(LinalgError::Lapack(
341-
lapack::error::Error::LapackComputationalFailure { return_code: 1 },
342+
lax::error::Error::LapackComputationalFailure { return_code: 1 },
342343
))
343344
.and_then(|(active_p, active_ap)| {
344345
let xap = x.t().dot(active_ap);

ndarray-linalg/src/lobpcg/svd.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
///! This module computes the k largest/smallest singular values/vectors for a dense matrix.
44
use super::lobpcg::{lobpcg, LobpcgResult, Order};
55
use crate::error::Result;
6-
use crate::{generate, Lapack, Scalar};
6+
use crate::generate;
7+
use cauchy::Scalar;
8+
use lax::Lapack;
79
use ndarray::prelude::*;
810
use ndarray::ScalarOperand;
911
use num_traits::{Float, NumCast};

ndarray-linalg/src/opnorm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//! Operator norm
22
3+
use lax::Tridiagonal;
34
use ndarray::*;
45

56
use crate::convert::*;
67
use crate::error::*;
78
use crate::layout::*;
8-
use crate::tridiagonal::Tridiagonal;
99
use crate::types::*;
1010

11-
pub use crate::lapack::NormType;
11+
pub use lax::NormType;
1212

1313
/// Operator norm using `*lange` LAPACK routines
1414
///

ndarray-linalg/src/qr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::layout::*;
1111
use crate::triangular::*;
1212
use crate::types::*;
1313

14-
pub use crate::lapack::UPLO;
14+
pub use lax::UPLO;
1515

1616
/// QR decomposition for matrix reference
1717
///

ndarray-linalg/src/solve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use crate::layout::*;
5555
use crate::opnorm::OperationNorm;
5656
use crate::types::*;
5757

58-
pub use crate::lapack::{Pivot, Transpose};
58+
pub use lax::{Pivot, Transpose};
5959

6060
/// An interface for solving systems of linear equations.
6161
///
@@ -468,7 +468,7 @@ where
468468
self.ensure_square()?;
469469
match self.factorize() {
470470
Ok(fac) => fac.sln_det(),
471-
Err(LinalgError::Lapack(e)) if matches!(e, lapack::error::Error::LapackComputationalFailure {..}) =>
471+
Err(LinalgError::Lapack(e)) if matches!(e, lax::error::Error::LapackComputationalFailure {..}) =>
472472
{
473473
// The determinant is zero.
474474
Ok((A::zero(), A::Real::neg_infinity()))
@@ -487,7 +487,7 @@ where
487487
self.ensure_square()?;
488488
match self.factorize_into() {
489489
Ok(fac) => fac.sln_det_into(),
490-
Err(LinalgError::Lapack(e)) if matches!(e, lapack::error::Error::LapackComputationalFailure { .. }) =>
490+
Err(LinalgError::Lapack(e)) if matches!(e, lax::error::Error::LapackComputationalFailure { .. }) =>
491491
{
492492
// The determinant is zero.
493493
Ok((A::zero(), A::Real::neg_infinity()))

ndarray-linalg/src/solveh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use crate::error::*;
5757
use crate::layout::*;
5858
use crate::types::*;
5959

60-
pub use crate::lapack::{Pivot, UPLO};
60+
pub use lax::{Pivot, UPLO};
6161

6262
/// An interface for solving systems of Hermitian (or real symmetric) linear equations.
6363
///
@@ -426,7 +426,7 @@ where
426426
fn sln_deth(&self) -> Result<(A::Real, A::Real)> {
427427
match self.factorizeh() {
428428
Ok(fac) => Ok(fac.sln_deth()),
429-
Err(LinalgError::Lapack(e)) if matches!(e, lapack::error::Error::LapackComputationalFailure {..}) =>
429+
Err(LinalgError::Lapack(e)) if matches!(e, lax::error::Error::LapackComputationalFailure {..}) =>
430430
{
431431
// Determinant is zero.
432432
Ok((A::Real::zero(), A::Real::neg_infinity()))
@@ -451,7 +451,7 @@ where
451451
fn sln_deth_into(self) -> Result<(A::Real, A::Real)> {
452452
match self.factorizeh_into() {
453453
Ok(fac) => Ok(fac.sln_deth_into()),
454-
Err(LinalgError::Lapack(e)) if matches!(e, lapack::error::Error::LapackComputationalFailure {..}) =>
454+
Err(LinalgError::Lapack(e)) if matches!(e, lax::error::Error::LapackComputationalFailure {..}) =>
455455
{
456456
// Determinant is zero.
457457
Ok((A::Real::zero(), A::Real::neg_infinity()))

ndarray-linalg/src/svddc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use super::{convert::*, error::*, layout::*, types::*};
44
use ndarray::*;
55

6-
pub use lapack::svddc::UVTFlag;
6+
pub use lax::UVTFlag;
77

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

ndarray-linalg/src/triangular.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//! Methods for triangular matrices
22
3+
use lax::*;
34
use ndarray::*;
45
use num_traits::Zero;
56

67
use super::convert::*;
78
use super::error::*;
8-
use super::lapack::*;
99
use super::layout::*;
1010
use super::types::*;
1111

12-
pub use super::lapack::Diag;
12+
pub use lax::Diag;
1313

1414
/// solve a triangular system with upper triangular matrix
1515
pub trait SolveTriangular<A, S, D>

ndarray-linalg/src/tridiagonal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
55
use super::convert::*;
66
use super::error::*;
7-
use super::lapack::*;
87
use super::layout::*;
98
use cauchy::Scalar;
9+
use lax::*;
1010
use ndarray::*;
1111
use num_traits::One;
1212

13-
pub use lapack::tridiagonal::{LUFactorizedTridiagonal, Tridiagonal};
13+
pub use lax::{LUFactorizedTridiagonal, Tridiagonal};
1414

1515
/// An interface for making a Tridiagonal struct.
1616
pub trait ExtractTridiagonal<A: Scalar> {

ndarray-linalg/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Basic types and their methods for linear algebra
22
3-
pub use super::lapack::Lapack;
43
pub use cauchy::Scalar;
4+
pub use lax::Lapack;
55

66
pub use num_complex::Complex32 as c32;
77
pub use num_complex::Complex64 as c64;

0 commit comments

Comments
 (0)