quil-lang / magicl

Matrix Algebra proGrams In Common Lisp.
BSD 3-Clause "New" or "Revised" License
237 stars 45 forks source link

add MAGICL:CSD-BLOCKS, define MAGICL:CSD on it, and other lisp-native routines #171

Closed stylewarning closed 2 years ago

stylewarning commented 2 years ago

This commit imports an implementation of CSD from the QUILC project, written by Juan Bello-Rivas (@jmbr).

It also includes a lot of code for implementing other functions natively in Lisp, written by Erik Davis (@kilimanjaro). These include QR, SVD, etc.

The purpose of this is to provide a regular interface to CSD for use by other packages. We solve this by providing two functions: csd-blocks (which is generic) which provides block-style results to the CSD, and csd which provides ordinary matrices.

Why expose csd-blocks? Both LAPACK, @jmbr, and various papers/documentation express the CSD algorithm in this way. QUILC, moreover, uses the block structure instead of the matrix structure directly. So it seems like a good idea to expose it.

CSD is also exposed, but it just calls CSD-BLOCKS underneath.

The companion PR https://github.com/quil-lang/quilc/pull/828 removes CSD from QUILC.

Still needed:

stylewarning commented 2 years ago

This code doesn't accomplish making MAGICL completely independent of LAPACK, but it moves us closer. All tests pass in MAGICL, and all tests pass in CL-QUIL. So I'm going to merge.