Skip to main content

Features

single-algebra provides a modular architecture where functionality can be selectively enabled through Cargo features. This allows you to include only the components you need, optimizing compilation time and binary size for your specific use case.

Available Features

Core Matrix Operations

These features are available by default and provide fundamental matrix operations:

  • sparse: Core sparse matrix functionality including CsrMatrix and CscMatrix implementations with operations for summing, counting non-zeros, finding min/max values, variance computation, and normalization.
  • dense: Operations on dense matrices via ndarray, including normalization and statistical functions.

Linear Algebra

  • lapack: Enables LAPACK-based implementations for SVD decomposition and other linear algebra operations using nalgebra-lapack with OpenBLAS backend.
  • nalgebra: Provides integration with the nalgebra library for linear algebra operations.
  • faer: Alternative linear algebra backend using the faer library, which provides fast implementations of common algorithms with pure Rust implementation.
  • simba: Support for generalized mathematical operations using the simba library.

Dimensionality Reduction

The library provides specialized implementations for dimensionality reduction:

  • PCA: Principal Component Analysis with configurable SVD backends
  • SparsePCA: Optimized implementation for sparse matrices
  • MaskedSparsePCA: PCA implementation that allows selective feature (gene) inclusion using boolean masks

Each implementation offers methods for:

  • Extracting principal components
  • Computing explained variance
  • Feature importance calculation
  • Data transformation

Similarity Measures

The library provides a collection of similarity measures through the similarity module:

  • CosineSimilarity: Measures the cosine of the angle between vectors
  • EuclideanSimilarity: Distance-based similarity using Euclidean distance
  • PearsonSimilarity: Correlation-based similarity using Pearson's correlation coefficient
  • ManhattanSimilarity: Distance-based similarity using Manhattan distance
  • JaccardSimilarity: Set-based similarity for binary or thresholded data

Note: Clustering and advanced machine learning functionality that was previously part of single-algebra has been moved to a separate library. If you're looking for Louvain method, Leiden algorithm, k-nearest neighbors graph construction, or community detection algorithms, please refer to the dedicated ML library in the SingleRust ecosystem. Statistical testing was moved to the crate: single-statistics.

Integration

  • smartcore: Integration with the smartcore machine learning library for additional algorithms.

Note: Integration with other libraries in the SingleRust ecosystem is handled automatically. No special features are required to use single-algebra with other SingleRust components.

Feature Dependencies

Some features have dependencies on other features:

  • lapack enables the nalgebra-lapack crate with OpenBLAS support.
  • faer enables the faer and faer-ext crates for pure Rust linear algebra.
  • simba enables the simba crate for additional numeric operations.

Selecting Features

You can enable specific features in your Cargo.toml:

[dependencies]
single-algebra = { version = "0.7.0", features = ["statistics", "faer"] }

For most bioinformatics applications, we recommend enabling:

  • statistics for statistical analysis capabilities
  • Either faer (pure Rust) or lapack (with OpenBLAS) for optimized linear algebra

Feature Combinations

Different feature combinations are useful for different scenarios:

  • Minimal footprint: Use default features for basic matrix operations
  • Performance-focused: Enable faer or lapack for optimized linear algebra
  • Statistical analysis: Enable the statistics feature for comprehensive statistical functionality

Default Configuration

By default, single-algebra is configured with minimal features to keep the dependency footprint small. For production applications, you'll typically want to enable the specific features required for your use case.

Version Compatibility

As of version 0.7.0, all features are compatible with the latest Rust compiler (1.70.0+). The library maintains backward compatibility with previous feature configurations while adding new capabilities.