Vector and Matrix Library User's Guide

Numerics.NET contains an extensive set of classes for vector and matrix calculations. All classes are generic over the element type, which can be real or complex. Several specialized matrix and vector types are available, including sparse vectors and matrices.

Two classes, Vector and Matrix, provide static methods to create vectors and matrices, respectively, and perform operations on them. The Vector<T> and Matrix<T> classes represent actual vector and matrix objects. The generic type parameter defines the element type, which can be anything, including complex numbers (Complex<T>). Calculations are supported as long as the element type supports the required operations.

The code uses the Basic Linear Algebra Subroutines (BLAS) at its core. Several implementations are provided. One is generic, written in 100% managed code, and works for all element types that define the relevant operations. One is still pure managed code, but specialized for elements of type Double and Complex<T> of Double. and is suitable for smaller problems and in situations where portability is of the essence. The third implementation is a hand-optimized native implementation based on Intel®'s Math Kernel Library. This implementation is suitable for large problems where performance is crucial.

In addition, a tensor library implements multidimensional arrays that can have more than 2 dimensions. The tensor library is optimized for calculations at scale. The API is different from the vector and matrix API which is geared more towards ‘classic’ linear algebra.

The classes in the Vector and Matrix Library are organized in a consistent namespace hierarchy rooted in the Numerics.NET.LinearAlgebra namespace. The structure of the namespaces is as follows:

Namespace

Description

Numerics.NET

Contains the static Vector and Matrix classes, the generic Vector<T> and Matrix<T> classes, enumeration types and exceptions.

Contains the static Tensor and Tensor<T> classes, as well as supporting types such as TensorShape.

Numerics.NET.LinearAlgebra

Contains specialized vector and matrix types, types that represent matrix decompositions, and some support classes.

Numerics.NET.LinearAlgebra.IterativeSolvers

Contains classes that implement iterative sparse solvers and preconditioners.

Numerics.NET.LinearAlgebra.Implementation

Contains classes that define and implement the low level BLAS and LAPACK interfaces.