MatrixLib v3

MatrixLib™ is a C++ implementation of one and two dimensional matrices. Ideal for science and engineering applications, this library provides an easy to use matrix class with an extensive body of functions and operations. Designed with efficiency as a priority, MatrixLib links against LAPACK (Linear Algebra PACKage) and the BLAS (Basic Linear Algebra Subprograms) for many of its internal calculations. Princeton Satellite Systems uses MatrixLib extensively for application development, greatly reducing the time and money needed to produce C++ implementations of control algorithms developed in MATLAB. Examples of use include flight software, multi-body dynamics simulations, and a telemetry and command system.

MatrixLib is designed to be cross-platform - programmers can use it on Windows, Macintosh OS, and Linux, and even transfer matrix data between different platforms over a network interface using built-in serialization functions. Pre-compiled binary libraries are available for all platforms, or users can negotiate a source code license.


MatrixLib contains over a hundred functions that fall into the following broad categories:

I/O functions include packaging to string and binary formats as well as a display to standard output. The linear algebra suite includes a linear equation solver, singular value decomposition, and simplex. Manipulation functions allow easy extraction and incorporation of sub-matrices, stack and append operations, and dynamic resizing.

In addition to using LAPACK and the BLAS internally, MatrixLib also provides an interface to these libraries, allowing users to access any of the many highly efficient routines for solving a wide variety of linear algebra problems. The interface consists of functions that allow a user to extract the necessary data from a matrix object to make arbitrary BLAS/LAPACK function calls in their own code.

The Inspection and Assignment module includes functions for comparing matrices, locating elements in a matrix, sorting the elements, applying functions on an element-by-element basis, and more. Arithmetic provides basic operations such as addition and multiplication, both matrix-matrix and matrix-scalar. Alebraic and Trigonometric apply standard functions to each element of a matrix, and Linear Algebra provides transposes, inverses, singular value decompositions, simplex methods, linear solvers, and more.

Easy to Use

MatrixLib makes development even easier by providing additional tools for debugging code. Users are given three versions of the MatrixLib libraries to link against - a production library and two different "debugging" libraries. MatrixLib protects against invalid operations by checking matrix dimensions, element values, data pointers, etc. Each matrix has an internal error field which is set when an invalid operation is attempted. In addition, the debugging versions of the library provide warning messages and stack tracing tools for locating the precise point at which an invalid operation originated.

The user documentation for MatrixLib includes a comprehensive application programming interface (API) reference with an online manual covering everything from installation to MATLAB-to-C++ code conversion to performance optimization. The documentation, including the complete list of functions, can be accessed via the link in the upper right side of this page. Please refer to the manual's MATLAB page to see examples of MATLAB equivalent functions and operations in MatrixLib.