Skip to main content

Requirements

single-algebra is designed to be lightweight and compatible across different platforms. However, some features depend on external libraries that may require additional setup. This page outlines the system requirements and dependencies needed for different components of the library.

Core Requirements

Rust

  • Minimum Rust Version: 1.61.0 or later
  • Recommended: Latest stable Rust version

Build Tools

  • Cargo: Included with Rust installation
  • C/C++ Compiler: Required for some dependencies
    • Linux: GCC or Clang
    • macOS: Clang (via Xcode Command Line Tools)
    • Windows: MSVC (via Visual Studio Build Tools)

Feature-Specific Requirements

LAPACK Feature

When using the lapack feature, you'll need:

  • OpenBLAS: Linear algebra performance library
    • Linux: Install via package manager (e.g., libopenblas-dev on Debian/Ubuntu)
    • macOS: Available via Homebrew (brew install openblas)
    • Windows: Provided automatically by the nalgebra-lapack crate

Clustering Feature

The clustering feature may require:

  • Additional Memory: Community detection algorithms can be memory-intensive for large networks
  • Multi-core CPU: For optimal performance with parallel implementations

Platform-Specific Considerations

Linux

All features are well-supported on Linux. For optimal performance:

# Debian/Ubuntu
sudo apt-get install build-essential libopenblas-dev

# Fedora/RHEL
sudo dnf install gcc-c++ openblas-devel

# Arch Linux
sudo pacman -S base-devel openblas

macOS

Most features work out-of-the-box on macOS. For LAPACK support:

# Install OpenBLAS
brew install openblas

# Set environment variables if needed
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openblas/lib

Windows

All features are supported on Windows with some additional setup:

  1. Install Visual Studio Build Tools with C++ support
  2. OpenBLAS is bundled with the nalgebra-lapack crate and should work automatically
  3. For some features, using Windows Subsystem for Linux (WSL) may provide better performance

Memory Requirements

Memory requirements depend on the size of your data and the algorithms you're using:

  • Core Operations: Minimal overhead beyond the data itself
  • SVD/PCA: Approximately 2-3x the size of your input matrix
  • Clustering: Variable, depending on network size and connectivity
  • Statistical Analysis: Generally low memory overhead

GPU Support

Currently, single-algebra does not directly support GPU acceleration. However:

  • The faer backend has optimizations for modern CPU architectures
  • The nalgebra-lapack backend can benefit from hardware-optimized BLAS implementations

Checking Your Environment

To verify that your environment is properly configured for single-algebra:

fn main() {
// Print library information
println!("single-algebra version: {}", single_algebra::version());

// Check available features
#[cfg(feature = "lapack")]
println!("LAPACK support: enabled");

#[cfg(feature = "clustering")]
println!("Clustering support: enabled");

// Test basic functionality
// (add simple code that exercises core functionality)
}

Troubleshooting Common Issues

Linker Errors with LAPACK

If you encounter linker errors when using the lapack feature:

  1. Ensure OpenBLAS is properly installed
  2. Check that library paths are correctly configured
  3. Consider using the faer feature instead, which is a pure Rust implementation

Memory Issues with Large Datasets

For large datasets:

  1. Consider using sparse matrix representations
  2. Enable only the features you need
  3. Process data in chunks where possible

Build Failures

If you encounter build failures:

  1. Update Rust to the latest stable version
  2. Make sure all system dependencies are installed
  3. Check that your C/C++ compiler is properly configured

For persistent issues, please consult the GitHub repository or open an issue with details about your environment and the problem you're experiencing.