Skip to content

Commit 654fe04

Browse files
committed
Run rustfmt
1 parent 4ca116f commit 654fe04

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

ndarray-linalg/src/lobpcg/eig.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<A: Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default> Truncate
7575

7676
/// Set the maximal number of iterations
7777
///
78-
/// The LOBPCG is an iterative approach to eigenproblems and stops when this maximum
78+
/// The LOBPCG is an iterative approach to eigenproblems and stops when this maximum
7979
/// number of iterations are reached.
8080
pub fn maxiter(mut self, maxiter: usize) -> Self {
8181
self.maxiter = maxiter;
@@ -184,7 +184,7 @@ impl<A: Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default> IntoIter
184184
/// let teig = TruncatedEig::new(a, TruncatedOrder::Largest)
185185
/// .precision(1e-5)
186186
/// .maxiter(500);
187-
///
187+
///
188188
/// // solve eigenproblem until eigenvalues get smaller than 0.5
189189
/// let res = teig.into_iter()
190190
/// .take_while(|x| x.0[0] > 0.5)

ndarray-linalg/src/lobpcg/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ mod svd;
44

55
pub use eig::{TruncatedEig, TruncatedEigIterator};
66
pub use lobpcg::{lobpcg, LobpcgResult, Order as TruncatedOrder};
7-
pub use svd::{TruncatedSvd, MagnitudeCorrection};
7+
pub use svd::{MagnitudeCorrection, TruncatedSvd};

ndarray-linalg/src/lobpcg/svd.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ mod tests {
200200
use super::TruncatedSvd;
201201
use crate::{close_l2, generate};
202202

203-
use rand::SeedableRng;
204-
use rand_xoshiro::Xoshiro256Plus;
205203
use ndarray::{arr1, arr2, Array1, Array2};
206204
use ndarray_rand::{rand_distr::StandardNormal, RandomExt};
205+
use rand::SeedableRng;
206+
use rand_xoshiro::Xoshiro256Plus;
207207

208208
use approx::assert_abs_diff_eq;
209209

@@ -239,12 +239,12 @@ mod tests {
239239
}
240240

241241
/// Eigenvalue structure in high dimensions
242-
///
242+
///
243243
/// This test checks that the eigenvalues are following the Marchensko-Pastur law. The data is
244244
/// standard uniformly distributed (i.e. E(x) = 0, E^2(x) = 1) and we have twice the amount of
245245
/// data when compared to features. The probability density of the eigenvalues should then follow
246246
/// a special densitiy function, described by the Marchenko-Pastur law.
247-
///
247+
///
248248
/// See also https://en.wikipedia.org/wiki/Marchenko%E2%80%93Pastur_distribution
249249
#[test]
250250
fn test_marchenko_pastur() {
@@ -258,14 +258,14 @@ mod tests {
258258
.decompose(500)
259259
.unwrap();
260260

261-
let sv = res.values().mapv(|x: f64| x*x);
261+
let sv = res.values().mapv(|x: f64| x * x);
262262

263263
// we have created a random spectrum and can apply the Marchenko-Pastur law
264264
// with variance 1 and p/n = 0.5
265-
let (a, b) = (
265+
let (a, b) = (
266266
1. * (1. - 0.5f64.sqrt()).powf(2.0),
267267
1. * (1. + 0.5f64.sqrt()).powf(2.0),
268-
);
268+
);
269269

270270
// check that the spectrum has correct boundaries
271271
assert_abs_diff_eq!(b, sv[0], epsilon = 0.1);
@@ -281,14 +281,14 @@ mod tests {
281281

282282
if i == sv.len() {
283283
break 'outer;
284-
}
285-
}
284+
}
285+
}
286286

287287
let x = th + 0.05;
288288
let mp_law = ((b - x) * (x - a)).sqrt() / std::f64::consts::PI / x;
289289
let empirical = count as f64 / 500. / ((2.8 - 0.1) / 28.);
290290

291291
assert_abs_diff_eq!(mp_law, empirical, epsilon = 0.05);
292-
}
293-
}
292+
}
293+
}
294294
}

0 commit comments

Comments
 (0)