Skip to content

Commit b2f2fe2

Browse files
authored
Merge pull request #24 from SingleRust/feature-dev-random-svd
Version bump and added sparse PCA SVD selection method
2 parents 0c4db61 + c999b5c commit b2f2fe2

File tree

5 files changed

+284
-89
lines changed

5 files changed

+284
-89
lines changed

Cargo.lock

Lines changed: 75 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "single_algebra"
3-
version = "0.2.3-alpha.3"
3+
version = "0.3.0-alpha.0"
44
edition = "2021"
55
license-file = "LICENSE.md"
66
description = "A linear algebra convenience library for the single-rust library. Can be used externally as well."
@@ -44,7 +44,7 @@ num-traits = "0.2.19"
4444
rayon = "1.10.0"
4545
simba = { version = "0.9.0", optional = true }
4646
smartcore = { version = "0.4", features = ["ndarray-bindings"], optional = true }
47-
single-svdlib = "0.2.0"
47+
single-svdlib = "0.8.0"
4848
parking_lot = "0.12.3"
4949
petgraph = { version = "0.7.1", features = ["rayon"] }
5050
rand = "0.9.0"

src/dimred/pca/mod.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
use rayon::prelude::*;
2-
31
pub mod dense;
42
mod sparse;
53

64
mod sparse_masked;
5+
6+
use single_svdlib::randomized::PowerIterationNormalizer;
77
pub use sparse::SparsePCA;
88
pub use sparse::SparsePCABuilder;
99
pub use sparse_masked::MaskedSparsePCA;
1010
pub use sparse_masked::MaskedSparsePCABuilder;
11+
12+
13+
#[derive(Debug, Clone, Copy, PartialEq)]
14+
pub enum SVDMethod {
15+
Lanczos,
16+
Random {
17+
n_oversamples: usize,
18+
n_power_iterations: usize,
19+
normalizer: PowerIterationNormalizer,
20+
},
21+
}
22+
23+
impl Default for SVDMethod {
24+
fn default() -> Self {
25+
Self::Lanczos
26+
}
27+
}
28+

0 commit comments

Comments
 (0)