All Projects → rigetti → Magicl

rigetti / Magicl

Licence: other
Matrix Algebra proGrams In Common Lisp.

Projects that are alternatives of or similar to Magicl

Nifty
Numerical computing in Swift – for Linux and macOS
Stars: ✭ 86 (-38.57%)
Mutual labels:  linear-algebra
Kokkos Kernels
Kokkos C++ Performance Portability Programming EcoSystem: Math Kernels - Provides BLAS, Sparse BLAS and Graph Kernels
Stars: ✭ 113 (-19.29%)
Mutual labels:  linear-algebra
Gosl
Linear algebra, eigenvalues, FFT, Bessel, elliptic, orthogonal polys, geometry, NURBS, numerical quadrature, 3D transfinite interpolation, random numbers, Mersenne twister, probability distributions, optimisation, differential equations.
Stars: ✭ 1,629 (+1063.57%)
Mutual labels:  linear-algebra
Q
Quantum Computation Simulator written in golang
Stars: ✭ 99 (-29.29%)
Mutual labels:  linear-algebra
Hackermath
Introduction to Statistics and Basics of Mathematics for Data Science - The Hacker's Way
Stars: ✭ 1,380 (+885.71%)
Mutual labels:  linear-algebra
Aardvark.base
Aardvark is an open-source platform for visual computing, real-time graphics and visualization. This repository is the basis for most platform libraries and provides basic functionality such as data-structures, math and much more.
Stars: ✭ 117 (-16.43%)
Mutual labels:  linear-algebra
Oneapi Spec
oneAPI Specification source files
Stars: ✭ 75 (-46.43%)
Mutual labels:  linear-algebra
Linear Algebra
Linear algebra for Nim
Stars: ✭ 132 (-5.71%)
Mutual labels:  linear-algebra
Xtensor Blas
BLAS extension to xtensor
Stars: ✭ 102 (-27.14%)
Mutual labels:  linear-algebra
Crashnote
A Note for Computer Graphics
Stars: ✭ 122 (-12.86%)
Mutual labels:  linear-algebra
Mit Deep Learning Book Pdf
MIT Deep Learning Book in PDF format (complete and parts) by Ian Goodfellow, Yoshua Bengio and Aaron Courville
Stars: ✭ 9,859 (+6942.14%)
Mutual labels:  linear-algebra
Lacaml
OCaml bindings for BLAS/LAPACK (high-performance linear algebra Fortran libraries)
Stars: ✭ 101 (-27.86%)
Mutual labels:  linear-algebra
Blasfeo
Basic linear algebra subroutines for embedded optimization
Stars: ✭ 120 (-14.29%)
Mutual labels:  linear-algebra
Krylovkit.jl
Krylov methods for linear problems, eigenvalues, singular values and matrix functions
Stars: ✭ 91 (-35%)
Mutual labels:  linear-algebra
Foundry
The Cognitive Foundry is an open-source Java library for building intelligent systems using machine learning
Stars: ✭ 124 (-11.43%)
Mutual labels:  linear-algebra
Cotila
A compile-time linear algebra system for C++
Stars: ✭ 78 (-44.29%)
Mutual labels:  linear-algebra
Foundational Knowledge For Programmers
List of resources about foundational knowledge for programmers (supposed to last a few decades)
Stars: ✭ 115 (-17.86%)
Mutual labels:  linear-algebra
Awesome Machine Learning Deep Learning Mathematics
A curated list of mathematics documents ,Concepts, Study Materials , Algorithms and Codes available across the internet for machine learning and deep learning
Stars: ✭ 138 (-1.43%)
Mutual labels:  linear-algebra
Eigen Git Mirror
THIS MIRROR IS DEPRECATED -- New url: https://gitlab.com/libeigen/eigen
Stars: ✭ 1,659 (+1085%)
Mutual labels:  linear-algebra
Numphp
Mathematical PHP library for scientific computing
Stars: ✭ 120 (-14.29%)
Mutual labels:  linear-algebra

MAGICL

Matrix Algebra proGrams In Common Lisp by Rigetti Computing. (née FLAIL: Finally, Linear Algebra In Lisp!)

(Note: The high-level interface is experimental and subject to rapid change.)

Requirements

  • SBCL (> 1.3.19) or CCL (>= 1.11) on AMD64
  • quicklisp
  • libffi
  • BLAS and LAPACK

Detailed instructions on how to install libffi and BLAS/LAPACK can be found here.

Currently this library is SBCL- and CCL-only. The non-portable code is in with-array-pointers.lisp and magicl.lisp.

Installation

First ensure you have the necessary requirements installed, as described in the previous section.

To install MAGICL, clone this repository into your Quicklisp's local-projects folder. You can quickly check where this is by running sbcl and evaluating ql:*local-project-directories*. Once installed, confirm that MAGICL is working properly by running the tests, as described in the next section.

Testing MAGICL

You can run the MAGICL tests from your Lisp REPL with:

(ql:quickload :magicl-tests)
(asdf:test-system :magicl)

High-level Interface

See high-level doc.

Showing Available Functions

Some distributions of a library don't actually provide all of the functions of the reference BLAS and LAPACK. One can look at a summary of available and unavailable functions with the function magicl:print-availability-report. By default, it will show all functions and their availability. There are three arguments to fine-tune this behavior:

  1. Key :show-available <boolean> (default t): show available functions
  2. Key :show-unavailable <boolean> (default t): show unavailable functions
  3. Key :search <string>: only show functions which have <string> as a substring. This argument takes into account the previous two arguments.

For example, we can look for all available functions which might relate to svd by doing the following:

CL-USER> (magicl:print-availability-report :search "svd" :show-unavailable nil)
        Fortran Function        Lisp Function
------------------------------------------------------------------------

Library LIBBLAS: /usr/local/opt/lapack/lib/libblas.dylib

Library LIBLAPACK: /usr/local/opt/lapack/lib/liblapack.dylib
    [x] CGESVD                  MAGICL.LAPACK-CFFI:%CGESVD
    [x] CGESVDX                 MAGICL.LAPACK-CFFI:%CGESVDX
    [x] CGGSVD3                 MAGICL.LAPACK-CFFI:%CGGSVD3
    [x] DBDSVDX                 MAGICL.LAPACK-CFFI:%DBDSVDX
    [x] DGESVD                  MAGICL.LAPACK-CFFI:%DGESVD
    [x] DGESVDX                 MAGICL.LAPACK-CFFI:%DGESVDX
    [x] DGGSVD3                 MAGICL.LAPACK-CFFI:%DGGSVD3
    [x] SBDSVDX                 MAGICL.LAPACK-CFFI:%SBDSVDX
    [x] SGESVD                  MAGICL.LAPACK-CFFI:%SGESVD
    [x] SGESVDX                 MAGICL.LAPACK-CFFI:%SGESVDX
    [x] SGGSVD3                 MAGICL.LAPACK-CFFI:%SGGSVD3
    [x] ZGESVD                  MAGICL.LAPACK-CFFI:%ZGESVD
    [x] ZGESVDX                 MAGICL.LAPACK-CFFI:%ZGESVDX
    [x] ZGGSVD3                 MAGICL.LAPACK-CFFI:%ZGGSVD3

Generating BLAS and LAPACK Bindings

This library takes the approach of automatically generating the bindings to BLAS, LAPACK, and Expokit without relying on any special tools.

In order to generate the bindings, you will need to download the Fortran 90 source tarballs for BLAS/LAPACK and Expokit. Once downloaded, extract the tarballs into a directory and re-generate the bindings with the following commands:

(ql:quickload :magicl-gen)
(in-package :magicl.generate-interface)
(generate-blas-files #P"/path/to/lapack-3.7.1/")
(generate-lapack-files* #P"/path/to/lapack-3.7.1/")
(generate-expokit-files #P"/path/to/expokit/")

Currently this will write to the source distribution directory of MAGICL, namely the files blas-cffi.lisp, lapack*-cffi.lisp, and expokit-cffi.lisp.

History and Credits

MAGICL development started at Rigetti Computing by Robert Smith and Joe Lin in 2017.

CL-BLAPACK is a library developed by Ryan Rifkin and Evan Monroig. Rigetti Computing created a fork of this library and renamed it MAGICL, and made significant changes that departed from the original design, including:

  • Fixing several bugs in the Fortran parsing to make it work with the latest reference BLAS and LAPACK, leading to significant refactoring.
  • Adding support for matrix exponentiation with Expokit.
  • Adding support for loading various BLAS and LAPACK implementations.
  • Removing the use of the FNV library in favor of native Lisp arrays.
  • Adding a high-level interface to various functions.
  • Adding function availability reporting.

The most important common design decision between CL-BLAPACK and MAGICL is allowing direct access to the Fortran library functions by way of automatically generated Lisp bindings from the reference sources.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].