Skip to content

Commit 6e67fd5

Browse files
committed
Fix dependency, doc test and formatting issues
1 parent 3c9f112 commit 6e67fd5

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ optional = true
5252
paste = "0.1.9"
5353
criterion = "0.3.1"
5454
approx = { version = "0.3.2", features = ["num-complex"] }
55-
num-complex = "0.3.0"
5655

5756
[[bench]]
5857
name = "truncated_eig"

src/least_squares.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//! ## Example
2828
//! ```rust
2929
//! use approx::AbsDiffEq; // for abs_diff_eq
30-
//! use ndarray::{Array1, Array2};
30+
//! use ndarray::{array, Array1, Array2};
3131
//! use ndarray_linalg::{LeastSquaresSvd, LeastSquaresSvdInto, LeastSquaresSvdInPlace};
3232
//!
3333
//! let a: Array2<f64> = array![
@@ -213,7 +213,7 @@ where
213213
impl<E, D> LeastSquaresSvdInto<D, E, Ix1> for ArrayBase<D, Ix2>
214214
where
215215
E: Scalar + Lapack + LeastSquaresSvdDivideConquer_,
216-
D: DataMut<Elem = E>,
216+
D: DataMut<Elem = E>,
217217
{
218218
/// Solve a least squares problem of the form `Ax = rhs`
219219
/// by calling `A.least_squares(rhs)`, where `rhs` is a
@@ -239,7 +239,7 @@ where
239239
impl<E, D> LeastSquaresSvdInto<D, E, Ix2> for ArrayBase<D, Ix2>
240240
where
241241
E: Scalar + Lapack + LeastSquaresSvdDivideConquer_,
242-
D: DataMut<Elem = E>,
242+
D: DataMut<Elem = E>,
243243
{
244244
/// Solve a least squares problem of the form `Ax = rhs`
245245
/// by calling `A.least_squares(rhs)`, where `rhs` is a
@@ -548,8 +548,8 @@ mod tests {
548548

549549
///////////////////////////////////////////////////////////////////////////
550550
/// Test that the different lest squares traits work as intended on the
551-
/// different array types.
552-
///
551+
/// different array types.
552+
///
553553
/// | least_squares | ls_into | ls_in_place |
554554
/// --------------+---------------+---------+-------------+
555555
/// Array | yes | yes | yes |
@@ -674,7 +674,6 @@ mod tests {
674674
assert_result(&a, &b, &res);
675675
}
676676

677-
678677
///////////////////////////////////////////////////////////////////////////
679678
/// Test cases taken from the netlib documentation at
680679
/// https://www.netlib.org/lapack/lapacke.html#_calling_code_dgels_code
@@ -742,22 +741,22 @@ mod tests {
742741
///////////////////////////////////////////////////////////////////////////
743742
/// Testing error cases
744743
///////////////////////////////////////////////////////////////////////////
745-
use ndarray::ErrorKind;
746744
use crate::layout::MatrixLayout;
745+
use ndarray::ErrorKind;
747746

748747
#[test]
749748
fn test_incompatible_shape_error_on_mismatching_num_rows() {
750749
let a: Array2<f64> = array![[1., 2.], [4., 5.], [3., 4.]];
751750
let b: Array1<f64> = array![1., 2.];
752751
let res = a.least_squares(&b);
753752
match res {
754-
Err(err) =>
755-
match err {
756-
LinalgError::Shape(shape_error) =>
757-
assert_eq!(shape_error.kind(), ErrorKind::IncompatibleShape),
758-
_ => panic!("Expected ShapeError")
759-
},
760-
_ => panic!("Expected Err()")
753+
Err(err) => match err {
754+
LinalgError::Shape(shape_error) => {
755+
assert_eq!(shape_error.kind(), ErrorKind::IncompatibleShape)
756+
}
757+
_ => panic!("Expected ShapeError"),
758+
},
759+
_ => panic!("Expected Err()"),
761760
}
762761
}
763762

@@ -769,13 +768,13 @@ mod tests {
769768

770769
let res = a.least_squares(&b);
771770
match res {
772-
Err(err) =>
773-
match err {
774-
LinalgError::Shape(shape_error) =>
775-
assert_eq!(shape_error.kind(), ErrorKind::IncompatibleShape),
776-
_ => panic!("Expected ShapeError")
777-
},
778-
_ => panic!("Expected Err()")
771+
Err(err) => match err {
772+
LinalgError::Shape(shape_error) => {
773+
assert_eq!(shape_error.kind(), ErrorKind::IncompatibleShape)
774+
}
775+
_ => panic!("Expected ShapeError"),
776+
},
777+
_ => panic!("Expected Err()"),
779778
}
780779
}
781780
}

0 commit comments

Comments
 (0)