@@ -200,10 +200,10 @@ mod tests {
200
200
use super :: TruncatedSvd ;
201
201
use crate :: { close_l2, generate} ;
202
202
203
- use rand:: SeedableRng ;
204
- use rand_xoshiro:: Xoshiro256Plus ;
205
203
use ndarray:: { arr1, arr2, Array1 , Array2 } ;
206
204
use ndarray_rand:: { rand_distr:: StandardNormal , RandomExt } ;
205
+ use rand:: SeedableRng ;
206
+ use rand_xoshiro:: Xoshiro256Plus ;
207
207
208
208
use approx:: assert_abs_diff_eq;
209
209
@@ -239,12 +239,12 @@ mod tests {
239
239
}
240
240
241
241
/// Eigenvalue structure in high dimensions
242
- ///
242
+ ///
243
243
/// This test checks that the eigenvalues are following the Marchensko-Pastur law. The data is
244
244
/// standard uniformly distributed (i.e. E(x) = 0, E^2(x) = 1) and we have twice the amount of
245
245
/// data when compared to features. The probability density of the eigenvalues should then follow
246
246
/// a special densitiy function, described by the Marchenko-Pastur law.
247
- ///
247
+ ///
248
248
/// See also https://en.wikipedia.org/wiki/Marchenko%E2%80%93Pastur_distribution
249
249
#[ test]
250
250
fn test_marchenko_pastur ( ) {
@@ -258,14 +258,14 @@ mod tests {
258
258
. decompose ( 500 )
259
259
. unwrap ( ) ;
260
260
261
- let sv = res. values ( ) . mapv ( |x : f64 | x* x) ;
261
+ let sv = res. values ( ) . mapv ( |x : f64 | x * x) ;
262
262
263
263
// we have created a random spectrum and can apply the Marchenko-Pastur law
264
264
// with variance 1 and p/n = 0.5
265
- let ( a, b) = (
265
+ let ( a, b) = (
266
266
1. * ( 1. - 0.5f64 . sqrt ( ) ) . powf ( 2.0 ) ,
267
267
1. * ( 1. + 0.5f64 . sqrt ( ) ) . powf ( 2.0 ) ,
268
- ) ;
268
+ ) ;
269
269
270
270
// check that the spectrum has correct boundaries
271
271
assert_abs_diff_eq ! ( b, sv[ 0 ] , epsilon = 0.1 ) ;
@@ -281,14 +281,14 @@ mod tests {
281
281
282
282
if i == sv. len ( ) {
283
283
break ' outer;
284
- }
285
- }
284
+ }
285
+ }
286
286
287
287
let x = th + 0.05 ;
288
288
let mp_law = ( ( b - x) * ( x - a) ) . sqrt ( ) / std:: f64:: consts:: PI / x;
289
289
let empirical = count as f64 / 500. / ( ( 2.8 - 0.1 ) / 28. ) ;
290
290
291
291
assert_abs_diff_eq ! ( mp_law, empirical, epsilon = 0.05 ) ;
292
- }
293
- }
292
+ }
293
+ }
294
294
}
0 commit comments