Skip to main content

Introduction

Overview

single-algebra is a comprehensive linear algebra library designed to provide efficient operations for both sparse and dense matrices, with a particular focus on computational biology and machine learning applications. It serves as the companion algebra library for the single-rust ecosystem, offering a balanced approach between performance and usability.

Philosophy

The core philosophy of single-algebra is to provide a unified interface for computational operations while maintaining flexibility across different mathematical contexts. Rather than reinventing fundamental algorithms, single-algebra builds upon established libraries like nalgebra and ndarray, extending them with domain-specific functionality that bridges the gap between general-purpose linear algebra and specialized scientific computing needs.

Three key principles guide the development of single-algebra:

  1. Efficiency with large data: Optimized for both sparse and dense matrix operations, with special attention to memory usage and computational performance on biological datasets.

  2. Composable functionality: Modular design allows users to combine operations in flexible ways, using traits to define capabilities that span different matrix representations.

  3. Scientific computing focus: Built-in statistical, dimensionality reduction, and clustering algorithms that are commonly needed in computational biology and data analysis.

Key Features

  • Matrix Operations: Comprehensive support for sparse matrix formats (CSR/CSC) with high-performance implementations
  • Dimensionality Reduction: PCA, sparse PCA, and SVD implementations
  • Clustering Algorithms: Community detection via Louvain and Leiden methods
  • Statistical Analysis: Hypothesis testing, effect size calculations, and multiple testing correction
  • Batch Processing: Flexible analysis of grouped data with masking support
  • Network Analysis: Graph-based algorithms for relational data processing

Getting Started

To incorporate single-algebra into your Rust project, add the following to your Cargo.toml:

[dependencies]
single-algebra = "0.2.2-alpha.0"

The library is organized into modules that can be selectively imported based on your needs:

// Import specific functionality
use single_algebra::sparse::MatrixSum;
use single_algebra::clustering::Louvain;
use single_algebra::statistics::inference::MatrixStatTests;

// Or import everything
use single_algebra::*;

In the following sections, we'll explore the different components of single-algebra and how they can be used in real-world applications.