{"id":13442560,"url":"https://github.com/quil-lang/magicl","last_synced_at":"2025-03-20T14:31:23.150Z","repository":{"id":37892121,"uuid":"98695958","full_name":"quil-lang/magicl","owner":"quil-lang","description":"Matrix Algebra proGrams In Common Lisp.","archived":false,"fork":false,"pushed_at":"2025-01-06T20:49:04.000Z","size":5016,"stargazers_count":240,"open_issues_count":63,"forks_count":46,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-01-06T21:32:31.105Z","etag":null,"topics":["common-lisp","linear-algebra","matrix-algebra"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quil-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-28T23:42:20.000Z","updated_at":"2025-01-06T20:49:09.000Z","dependencies_parsed_at":"2022-07-09T10:30:16.897Z","dependency_job_id":"819cc04e-e8a2-4f59-a182-18a999df9548","html_url":"https://github.com/quil-lang/magicl","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quil-lang%2Fmagicl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quil-lang%2Fmagicl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quil-lang%2Fmagicl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quil-lang%2Fmagicl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quil-lang","download_url":"https://codeload.github.com/quil-lang/magicl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244630164,"owners_count":20484327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["common-lisp","linear-algebra","matrix-algebra"],"created_at":"2024-07-31T03:01:47.263Z","updated_at":"2025-03-20T14:31:22.573Z","avatar_url":"https://github.com/quil-lang.png","language":"Common Lisp","readme":"# MAGICL\n\n_Matrix Algebra proGrams In Common Lisp_ by [Rigetti Computing](http://www.rigetti.com). (née FLAIL: _Finally, Linear Algebra In Lisp!_)\n\n(**Note**: The high-level interface is experimental and subject to change.)\n\n## Requirements\n\nMAGICL has two main systems:\n\n- `MAGICL/CORE`: This is pure Lisp code with no foreign\ndependencies. This system establishes MAGICL's API (for the most\npart).\n\n- `MAGICL`: This is MAGICL with all extensions loaded.\n\nThe system `MAGICL/CORE` requires:\n\n* SBCL (\u003e 1.3.19), CCL (\u003e= 1.11) or ECL (\u003e= 20.4.24) on AMD64\n* quicklisp\n\nThe system `MAGICL`, on the other hand, requires several foreign\ndependencies not shipped with MAGICL, like:\n\n- libffi\n- BLAS and LAPACK\n\nDetailed instructions on how to install `libffi` and BLAS/LAPACK can\nbe found [here](doc/requirements.md).\n\nCurrently this library is SBCL-, CCL- and ECL-only. The non-portable code is\nin `with-array-pointers.lisp` and `magicl.lisp`.\n\n## Installation\n\nFirst ensure you have the necessary requirements installed, as\ndescribed in the previous section.\n\nTo install MAGICL, clone this repository into your Quicklisp's\n`local-projects` folder. You can quickly check where this is by\nrunning `sbcl` and evaluating `ql:*local-project-directories*`. Once\ninstalled, confirm that MAGICL is working properly by running the\ntests, as described in the next section.\n\n## Lisp-Only vs Accelerated MAGICL\n\n### Extensions\n\n`MAGICL/CORE` only uses pure ANSI Common Lisp code. If you wish to\naccelerate it or extend the functionality, you may load *MAGICL\nextensions*. These extensions typically install new backends to MAGICL\nfunctions. The available extensions are:\n\n- `MAGICL/EXT-BLAS`: for BLAS functions\n- `MAGICL/EXT-LAPACK`: for LAPACK functions\n- `MAGICL/EXT-EXPOKIT`: for expokit (matrix `exp()`) functions\n\nFor backwards compatibility, `MAGICL` loads every extension under the\nkitchen sink. **This may change in future versions of MAGICL! If you\ndepend on an extension, depend on it explicitly!**\n\nIf you use extensions, you'll need the requisite C/Fortran\nlibraries. Expokit will automatically build for you, as its source is\nincluded in the distribution of MAGICL.\n\n### Backends\n\nAccelerated functionality is installed with a notion called \"backends\". A\n*backend* is a name of a group of functionality, typically denoted by\na symbol or keyword. The `:lisp` backend is the default one, and\nseveral backends can be active all at once. Each extension above adds\na new backend. The current backends are:\n\n- `:lisp`: Pure Lisp code\n- `:blas`: BLAS-backed code\n- `:lapack`: LAPACK-backed code\n- `:expokit`: expokit-backed code\n\nIn most cases, one does not need to concern themselves with backends;\nMAGICL functionality should \"just work\" and dispatch to the\nappropriate backend. However, the programmer always has control, even\ndynamically in the program, of which backends should be used at a\ngiven time with the `magicl.backends:with-backends` macro. For instance,\n\n```\n(magicl.backends:with-backends (:blas :lisp)\n  ;; ... code ...\n  )\n```\n\nsays that the code should be executed, always preferring\n`:blas`-accelerated functions, and using `:lisp`-implemented functions\nas a fall-back.\n\n```\n(magicl.backends:with-backends (:lisp)\n  ;; ... code ...\n  )\n```\n\nsays to *only* use `:lisp`-implemented functions, even if other\nbackends are loaded.\n\n\nThe active backends can be found with the function\n`magicl.backends:active-backends`, which lists the backends to use in\npriority order.\n\nOne can be even finer-grained than `with-backends`. Given a function\n`f` which has many backend implementations, one can get a specific\nimplementation by using the function:\n\n```\n(magicl.backends:backend-implementation 'f :backend-name)\n```\n\nFor instance\n\n```\n(magicl.backends:backend-implementation 'magicl:csd :lapack)\n```\n\nwill give the implementation of the cosine-sine decomposition function\nin LAPACK. This can be called in exactly the same way `magicl:csd` can\nbe called.\n\nIn `backend-implementation`, if both the function name and the backend\nname are (quoted) constants, this will be looked up at compile-time,\nwhich is useful for writing efficient code that does not dispatch. But\nnote that by doing this, `with-backends` will not be respected.\n\n## Testing MAGICL\n\nYou can run the MAGICL tests from your Lisp REPL with:\n\n```\n(asdf:test-system :magicl)\n```\n\nYou currently need all of the extensions working for the tests to run.\n\n## High-level Interface\n\nSee the [high-level doc](doc/high-level.md) for an extensive discussion\nand comparison of MAGICL functions with those of MATLAB and NumPy.\n\n## Developer's Guide: How to Add New Functions\n\nSee the [developer how-to](doc/dev-how-to.md) to understand how to add\nnew functionality to MAGICL.\n\n## Fortran Bindings\n\nSee the [Fortran Functions](doc/fortran-functions.md) on how to\nre-generate the Fortran bindings from the original BLAS, LAPACK, and\nExpokit reference code.\n\nSee the same document for how to query for available Fortran functions\nin the currently loaded dynamic libraries.\n\n\n## History and Credits\n\nMAGICL development started at Rigetti Computing by Robert Smith and\nJoe Lin in 2017.\n\n[CL-BLAPACK](https://github.com/blindglobe/cl-blapack) is a library\ndeveloped by Ryan Rifkin and Evan Monroig. Rigetti Computing created a\nfork of this library and renamed it MAGICL, and made significant\nchanges that departed from the original design, including:\n\n* Fixing several bugs in the Fortran parsing to make it work with the\nlatest reference BLAS and LAPACK, leading to significant refactoring.\n\n* Adding support for matrix exponentiation with Expokit.\n\n* Adding support for loading various BLAS and LAPACK implementations.\n\n* Removing the use of the FNV library in favor of native Lisp arrays.\n\n* Adding a high-level interface to various functions.\n\n* Adding function availability reporting.\n\nThe most important common design decision between CL-BLAPACK and\nMAGICL is allowing direct access to the Fortran library functions by\nway of automatically generated Lisp bindings from the reference\nsources.\n","funding_links":[],"categories":["Common Lisp","Interfaces to other package managers"],"sub_categories":["Third-party APIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquil-lang%2Fmagicl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquil-lang%2Fmagicl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquil-lang%2Fmagicl/lists"}