A Common Lisp library for matrix algebra with pure Lisp and accelerated backends via BLAS/LAPACK.
MAGICL (Matrix Algebra proGrams In Common Lisp) is a comprehensive linear algebra library for Common Lisp, originally developed by Rigetti Computing. It provides a portable pure Lisp core for matrix operations and optional accelerated backends using BLAS, LAPACK, and Expokit, making it suitable for scientific and quantum computing applications where performance and flexibility are needed.
Common Lisp developers working on scientific computing, numerical analysis, or quantum computing projects that require efficient linear algebra operations. It is also aimed at researchers or engineers who need a blend of portability and high performance in their Lisp-based numerical code.
Developers choose MAGICL for its dual approach: a dependency-free pure Lisp core ensures portability, while extensible backends allow leveraging optimized C/Fortran libraries like BLAS and LAPACK for speed. Its flexible backend system with dynamic selection and priority control gives fine-grained performance tuning, and its high-level interface eases adoption for users familiar with MATLAB or NumPy.
Matrix Algebra proGrams In Common Lisp.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The MAGICL/CORE system is entirely ANSI Common Lisp with no foreign dependencies, ensuring it runs portably on supported implementations without external libraries.
Optional extensions like MAGICL/EXT-BLAS and MAGICL/EXT-LAPACK leverage optimized C/Fortran libraries for significant speed improvements in numerical computations.
The with-backends macro allows fine-grained, dynamic prioritization of backends (e.g., :blas over :lisp) for performance tuning, as detailed in the backend system documentation.
Functions mimic MATLAB and NumPy interfaces, easing adoption for users from those ecosystems, as described in the high-level documentation.
Lisp bindings are automatically generated from reference BLAS, LAPACK, and Expokit sources, ensuring accurate and direct low-level access without manual coding.
MAGICL only works with SBCL, CCL, and ECL on AMD64, excluding other Common Lisp implementations due to non-portable code in specific files.
The README explicitly warns that the high-level interface is experimental and subject to change, making it risky for long-term or production use.
Accelerated versions require installing and configuring foreign libraries like libffi, BLAS, and LAPACK, which can be challenging and system-dependent.
The default loading of all extensions may change in future versions, forcing developers to manage dependencies explicitly to avoid breakage, as noted in the README.