Sparse linear algebra

ALGLIB numerical analysis library provides a rich set of sparse matrix functions available from C++, C#, Java and several other programming languages. The library supports several sparse matrix storage formats, sparse BLAS (sparse GEMV and its variants), factorizations (sparse Cholesky, LDLT and LU), direct and iterative sparse linear solvers.

Being a dual-licensed library, ALGLIB includes a free and a commercial edition. A fully functional free edition is ideal for academic research or small non-commercial projects. The commercial edition is intended for those seeking high performance, priority support, or the ability to use the library in commercial applications.

Contents

    1 Getting started
           Sparse matrix storage formats and initialization
           Using sparse matrices
    2 Sparse linear algebra functions
           Sparse BLAS
           Sparse Cholesky and other triangular factorizations
           Sparse direct linear solvers
           Sparse iterative linear solvers
           Sparse eigensolvers
    3 Other sparsity-aware functions
    4 Downloads section

Getting started

Sparse matrix storage formats and initialization

ALGLIB supports several sparse matrix storage formats optimized for various sparsity patterns and operations:

We recommend using HTS format first because of its easy and convenient initialization, followed by conversion to CRS as soon as possible, as it offers the best performance.

Using sparse matrices

The basis sparse matrix functionality is provided in a sparse subpackage of the LinAlg package. This functionality includes:

The ALGLIB Reference Manual includes several examples of sparse matrix initialization and usage, including sparse_d_1 and sparse_d_crs.

Sparse linear algebra functions

Sparse BLAS

The sparse subpackage of the LinAlg package also provides a rich set of fast and efficient sparse BLAS functions, including:

Our sparse linear algebra implementation efficiently handles both small and extremely large sparse matrices. As long as one has enough RAM, it is possible to handle matrices with more than 1.000.000.000 elements.

Sparse Cholesky and other triangular factorizations

Sparse triangular factorization is an important part of any sparse matrix package. The following sparse factorizations are provided in the trfac subpackage:

The commercial version of the sparse Cholesky solver supports multithreading. However, specific speed-up heavily depends on a sparsity pattern of a matrix being factorized.

Sparse direct linear solvers

A direct linear solver is one that relies on some kind of (sparse) triangular factorization to solve a linear system. ALGLIB provides several direct sparse solvers in its directsparsesolvers subpackage:

Direct solvers usually provide the most accurate results - at least 6 digits of precision (often, many more than that). The biggest drawback is that they have unpredictable memory/time requirements - it is hard to tell in advance how much memory and time will be needed to perform a factorization.

Sparse iterative linear solvers

An iterative linear solver usually solves a linear system through a sequence of matrix-vector products. Sparse iterative solvers are provided by the iterativesparse, linlsqr, and lincg subpackages, which include the following algorithms:

When compared with direct solvers, iterative solvers usually have much more predictable memory requirements but much less predictable accuracy. Usually, they allocate only a limited amount of additional memory bounded by O(max(M,N), which can easily be predicted in advance. What is difficult to predict is how many iterations will be necessary to converge to 6 digits of precision.

Sparse eigensolvers

Eigenproblems with sparse matrices are an important subset of linear algebra. evd subpackage includes a subspace iteration eigensolver which can be used to compute several top eigenvalues/vectors of a large sparse matrix.

Other sparsity-aware functions

Many other algorithms in ALGLIB can utilize the sparsity of their inputs, such as:

Download ALGLIB for C++ / C# / Java / Python / ...

ALGLIB Project offers you two editions of ALGLIB:

ALGLIB Free Edition:
+delivered for free
+offers full set of numerical functionality
+extensive algorithmic optimizations
-no multithreading
-non-commercial license

ALGLIB Commercial Edition:
+flexible pricing
+offers full set of numerical functionality
+extensive algorithmic optimizations
+high performance (SMP, SIMD)
+commercial license with support plan

Links to download sections for Free and Commercial editions can be found below:

ALGLIB 4.01.0 for C++

C++ library.
Delivered with sources.
Monolithic design.
Extreme portability.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for C#

C# library with native kernels.
Delivered with sources.
VB.NET and IronPython wrappers.
Extreme portability.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for Java

Java wrapper around HPC core.
Delivered with sources.
Seamless integration with Java.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for Delphi

Delphi wrapper around C core.
Delivered as precompiled binary.
Compatible with FreePascal.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for CPython

CPython wrapper around C core.
Delivered as precompiled binary.
Editions:   FREE   COMMERCIAL