# The lla Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

# The lla Reference Manual

This is the lla Reference Manual, version 0.2, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:15:45 2018 GMT+0.

Next: , Previous: , Up: Top   [Contents][Index]

## 1 Introduction

#+TITLE: Lisp Linear Algebra --- a linear algebra library for Common Lisp
#+OPTIONS:   TeX:t LaTeX:t

LLA is a high-level Common Lisp library built on on [[http://www.netlib.org/blas/][BLAS]] and [[http://www.netlib.org/lapack/][LAPACK]], but providing a much more abstract interface with the purpose of freeing the user from low-level concerns and reducing the number of bugs in numerical code.

Documentation is mostly in docstrings at the moment, but I plan to write a decent tutorial at some point.  In the meantime, please look at the unit tests.

* Objectives

- High-level, user friendly interface that hides the details.

=(solve a b)= should return $X$, from $AX=B$, regardless of
whether $A$ is a dense matrix, an $LU$ decomposition, or something else; similarly, $X$ should be a vector/matrix when $B$ is.  Users should not need to memorize names like =DGESV=, especially when CLOS makes it so easy to deal with these things.  Also, you don't need to make sure that all arguments are of the same type (eg complex-double): LLA will find the common supertype for elements and convert if necessary.

- Stay in Lisp and expose the innards of the objects as much as possible.

LLA aims to take advantage of CL's high level facilities such as CLOS and memory management.  Data is kept in Lisp arrays instead of foreign arrays, so you can access it directly using =aref= etc.  You also
benefit from garbage collection and all the clever stuff that comes
with the GC.  If you need more memory, just increase the heap size.

- Keeping it simple.

Currently, LLA sources amount to less than 3000 lines of code (not including tests).  The small size should make maintainance easier and bugs more rare (hopefully).

- Speed is important, but reliability comes first.

Only optimize when necessary, and do extensive testing afterwards.  Most of the speed comes from your LAPACK library anyway --- most linear algebra operations are $O(N^\alpha)$ with $\alpha > 1$, frequently $\alpha > 2$.  That said, copying to memory is optimized, and in the long run LLA should make use of your implementation's array pinning features (when available).  /Currently, direct array sharing is disabled, it will be re-enabeld in the near future/.

* Reporting bugs

Please report bugs using [[https://github.com/tpapp/lla/issues][Github's issue tracker]].  Small self-contained examples are appreciated when applicable, otherwise please try to provide a backtrace.  Feel free to submit efficiency/wishlist bugs too: if you need an interface for a particular LAPACK routine I will be happy to help with that and then possibly incorporate it into LLA.

* Configuration

Certain features of LLA can be configured before loading using the plist =*lla-configuration*= in the =CL-USER= package (for example, on SBCL you would do it in your =~/.sbclrc=).  The following properties are supported:

- =:libraries=

A list of objects, passed directly to =cffi:load-foreign-library=.  You can use strings, paths, or even symbols if you have defined these libraries using =cffi:define-foreign-library=.  If you don't define this, a reasonable platform-dependent default will be used.  See the next section for details.

- =:int64=

This makes LLA use 64-bit integers for array dimensions, pivot indices and other integer values passed to BLAS/LAPACK functions.  *Only use this if you are sure that your libraries have been compiled with 64-bit integers*.  The fact that you have a 64-bit platform does not necessarily mean that this is the case, in fact, it is still quite rare.  Unless told otherwise, LLA expectes BLAS/LAPACK to use the [[http://en.wikipedia.org/wiki/64-bit#64-bit_data_models][(L)LP64 model]] for integers -- that is to say, integer types in Fortran are 32 bit.

- =:efficiency-warnings=

Enable the *possibility* of efficiency warnings at compile time.  You still have to set the appropriate flags, but without this option, they won't even be checked.  There are two properties you can set: =:array-type= and =:array-conversion=.  The first warns whenever an array has to be walked elementwise to determine its type, the second when some arrays need to be converted to a common type.

Example:

#+BEGIN_SRC lisp
(defparameter cl-user:*lla-configuration*
'(:efficiency-warnings (:array-type :array-conversion)))
#+END_SRC

#+BEGIN_SRC lisp
(let ((lla:*lla-efficiency-warning-array-type* t)
(lla:*lla-efficiency-warning-array-conversion* t))
(code that you want to check))
#+END_SRC

* Libraries

** Dependencies and configuration

LLA needs BLAS and LAPACK shared libraries to work.  When it comes to loading libraries, LLA tries to pick a sensible default for each platform, but in case it fails, you need to tell LLA where the libraries are before loading.

You can do this by putting something like this in your startup script (eg =~/.sbclrc=, the symbol needs to be in the package =cl-user=):

#+BEGIN_SRC lisp
(defvar *lla-configuration*
'(:libraries ("/usr/lib/atlas-base/atlas/libblas.so.3gf"
"/usr/lib/atlas-base/libatlas.so.3gf")))
#+END_SRC

** Debian

On Debian-based distributions, it is very likely that LLA will work out of the box if you just install ATLAS, eg

#+BEGIN_EXAMPLE
apt-get install libatlas3gf-base
#+END_EXAMPLE

However, you may want to build a version optimized for your architecture.

*** Building ATLAS on Debian

Prepare the build (as root):

#+BEGIN_EXAMPLE
apt-get build-dep atlas
apt-get install fakeroot devscripts
cpufreq-set -g performance -c 0   # do this for all CPUs
#+END_EXAMPLE

Then as a regular user,

#+BEGIN_EXAMPLE
apt-get source atlas
cd atlas-[fill in your version here]/
fakeroot debian/rules custom
#+END_EXAMPLE

Then install the .deb files that were created.

*** Selecting the right linear algebra library

#+BEGIN_EXAMPLE
update-alternatives --config libblas.so.3
update-alternatives --config liblapack.so.3
#+END_EXAMPLE

** Intel MKL on Linux

In =/etc/ld.so.conf.d/=, create a file that contains the paths, eg
#+BEGIN_EXAMPLE
/opt/intel/mkl/lib/intel64
/opt/intel/composerxe/lib/intel64
#+END_EXAMPLE

Then the configuration
#+BEGIN_SRC lisp
(defvar *lla-configuration*
#+END_SRC
should work.

* Acknowledgements

LLA was inspired by packages written by AJ Rossini, Rif, Mark Hoemmen and others.  I have borrowed code (whenever allowed by their licenses) and ideas freely from all of them.

GĂˇbor Melis made substantial contributions to the library, especially the low-level pinning interface and the destructive BLAS routines.

* Suggested editor settings for code contributions

No line breaks in (doc)strings, otherwise try to keep it within 80 columns.  Remove trailing whitespace.  'modern' coding style.  Suggested Emacs snippet:
#+BEGIN_SRC emacs-lisp
(set-fill-column 9999)
'(("\\<\$$FIXME\\|TODO\\|QUESTION\\|NOTE\$$"
1 font-lock-warning-face t)))
(setq show-trailing-whitespace t)
'(lambda()
(save-excursion
(delete-trailing-whitespace))
nil))
(visual-line-mode 1)
(setq slime-net-coding-system 'utf-8-unix)
(setq lisp-lambda-list-keyword-parameter-alignment t)
(setq lisp-lambda-list-keyword-alignment t)
(setq common-lisp-style-default 'modern)
#+END_SRC

* Things to do (roughly in order of priority)

- write optimized pinning interfaces, especially ECL
- write documentation (probably w/ [[http://common-lisp.net/project/docudown/][docudown]], decide)
- write more tests (especially randomized ones, develop macros for that)
- write a tutorial



Next: , Previous: , Up: Top   [Contents][Index]

## 2 Systems

The main system appears first, followed by any subsystem dependency.

Previous: , Up: Systems   [Contents][Index]

### 2.1 lla

Author

Tamas K Papp <tkpapp@gmail.com>

Boost Software License - Version 1.0

Description

Lisp Linear Algebra

Version

0.2

Dependencies
• anaphora
• alexandria
• cffi
• cl-num-utils
• cl-slice
• let-plus
Source

lla.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

## 3 Files

Files are sorted by type and then listed depth-first from the systems components trees.

Previous: , Up: Files   [Contents][Index]

### 3.1 Lisp

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.1 lla.asd

Location

/home/quickbuilder/quicklisp/dists/quicklisp/software/lla-20140826-git/lla.asd

Systems

lla (system)

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.2 lla/package.lisp

Parent

lla (system)

Location

package.lisp

Packages

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.3 lla/configuration-interface.lisp

Dependency

package.lisp (file)

Parent

lla (system)

Location

configuration-interface.lisp

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.4 lla/configuration.lisp

Dependency
Parent

lla (system)

Location

configuration.lisp

Internal Definitions

default-libraries (function)

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.5 lla/libraries.lisp

Dependency

configuration.lisp (file)

Parent

lla (system)

Location

libraries.lisp

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.6 lla/conditions.lisp

Dependency

libraries.lisp (file)

Parent

lla (system)

Location

conditions.lisp

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.7 lla/types.lisp

Dependency

conditions.lisp (file)

Parent

lla (system)

Location

types.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.8 lla/foreign-memory.lisp

Dependency

types.lisp (file)

Parent

lla (system)

Location

foreign-memory.lisp

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.9 lla/pinned-array.lisp

Dependency

foreign-memory.lisp (file)

Parent

lla (system)

Location

pinned-array.lisp

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.10 lla/factorizations.lisp

Dependency

pinned-array.lisp (file)

Parent

lla (system)

Location

factorizations.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.11 lla/fortran-call.lisp

Dependency

factorizations.lisp (file)

Parent

lla (system)

Location

fortran-call.lisp

Exported Definitions

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.12 lla/linear-algebra.lisp

Dependency

fortran-call.lisp (file)

Parent

lla (system)

Location

linear-algebra.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

#### 3.1.13 lla/blas.lisp

Dependency

linear-algebra.lisp (file)

Parent

lla (system)

Location

blas.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

## 4 Packages

Packages are listed by definition order.

Previous: , Up: Packages   [Contents][Index]

### 4.1 lla

Source

package.lisp (file)

Use List
• let-plus
• cl-slice
• cl-num-utils
• cffi
• anaphora
• alexandria.0.dev
• common-lisp
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

## 5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.

Next: , Previous: , Up: Definitions   [Contents][Index]

### 5.1 Exported definitions

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.1 Special variables

Special Variable: *lla-efficiency-warning-array-conversion*

Toggles whether conversion of array elements to another type when used with foreign functions raises an LLA-EFFICIENCY-WARNING-ARRAY-CONVERSION warning.

Effective only when LLA was loaded & compiled with the appropriate settings in CL-USER::*LLA-CONFIGURATION*. See the documentation on configuration in the README.

Package
Source

conditions.lisp (file)

Special Variable: *lla-efficiency-warning-array-type*

Toggles whether arrays with types not recognized as LLA types raise an LLA-EFFICIENCY-WARNING-ARRAY-TYPE warning.

Effective only when LLA was loaded & compiled with the appropriate settings in CL-USER::*LLA-CONFIGURATION*. See the documentation on configuration in the README.

Package
Source

conditions.lisp (file)

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.2 Macros

Package
Source

fortran-call.lisp (file)

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.3 Functions

Function: asum X &key N INCX

Return the L1 norm of X.

Package
Source

blas.lisp (file)

Function: axpy! ALPHA X Y &key N INCX INCY
Package
Source

blas.lisp (file)

Function: copy! X Y &key N INCX INCY
Package
Source

blas.lisp (file)

Function: det MATRIX

Determinant of a matrix. If you need the log of this, use LOGDET directly.

Package
Source

linear-algebra.lisp (file)

Function: dot X Y &key N INCX INCY
Package
Source

blas.lisp (file)

Function: eigenvalues A &key ABSTOL

Return the eigenvalues of A. See the documentation of SPECTRAL-FACTORIZATION about ABSTOL.

Package
Source

linear-algebra.lisp (file)

Function: gemm! ALPHA A B BETA C &key TRANSPOSE-A? TRANSPOSE-B? M N K LDA LDB LDC

Basically C = ALPHA * A’ * B’ + BETA * C. A’ is A or its transpose depending on TRANSPOSE-A?. B’ is B or its transpose depending on TRANSPOSE-B?. Returns C.

A’ is an MxK matrix. B’ is a KxN matrix. C is an MxN matrix.

LDA is the width of the matrix A (not of A’). If A is not transposed, then K <= LDA, if it’s transposed then M <= LDA.

LDB is the width of the matrix B (not of B’). If B is not transposed, then N <= LDB, if it’s transposed then K <= LDB.

In the example below M=3, N=2, K=5, LDA=6, LDB=3, LDC=4. The cells marked with + do not feature in the calculation.

N
–+
–+
K -B+
–+
–+
+++
K
—–+ –++
M –A–+ -C++
—–+ –++
++++++ ++++

Package
Source

blas.lisp (file)

Function: ipiv OBJECT

Pivot indices, counting from 0, in a format understood by SLICE. Example:

(let+ (((&accessors-r/o lu-l lu-u ipiv) (lu a)))
(num= (slice a ipiv) (mm lu-l lu-u) ipiv-inverse t)) ; => T

Package
Source

factorizations.lisp (file)

Function: ipiv-inverse OBJECT

Inverted permutation for pivot indices, in a format understood by SLICE.

Example:

(let+ (((&accessors-r/o lu-l lu-u ipiv-inverse) (lu a)))
(num= a (slice (mm lu-l lu-u) ipiv-inverse t))) ; => T

Package
Source

factorizations.lisp (file)

Function: least-squares Y X &rest REST &key METHOD &allow-other-keys
Package
Source

linear-algebra.lisp (file)

Function: lu-l LU

Return the L part of an LU factorization.

Package
Source

factorizations.lisp (file)

Function: lu-u LU

Return the U part of an LU factorization.

Package
Source

factorizations.lisp (file)

Function: mmm &rest MATRICES

Multiply arguments from left to right using MM.

Package
Source

linear-algebra.lisp (file)

Function: nrm2 X &key N INCX

Return the L2 norm of X.

Package
Source

blas.lisp (file)

Function: qr-r QR

Return the R part of a QR factorization.

Package
Source

factorizations.lisp (file)

Function: scal! ALPHA X &key N INCX

X = alpha * X.

Package
Source

blas.lisp (file)

Function: spectral-factorization A &key ABSTOL

Return a spectral factorization of A.

The LAPACK manual says the following about ABSTOL:

The absolute error tolerance for the eigenvalues. An approximate eigenvalue is accepted as converged when it is determined to lie in an interval [a,b] of width less than or equal to

ABSTOL + EPS * max( |a|,|b| ) ,

where EPS is the machine precision. If ABSTOL is less than or equal to zero, then EPS*|T| will be used in its place, where |T| is the 1-norm of the tridiagonal matrix obtained by reducing A to tridiagonal form.

See "Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy," by Demmel and Kahan, LAPACK Working Note #3.

If high relative accuracy is important, set ABSTOL to DLAMCH( ’Safe minimum’). Doing so will guarantee that eigenvalues are computed to high relative accuracy when possible in future releases. The current code does not make any guarantees about high relative accuracy, but furutre releases will. See J. Barlow and J. Demmel, "Computing Accurate Eigensystems of Scaled Diagonally Dominant Matrices", LAPACK Working Note #7, for a discussion of which matrices define their eigenvalues to high relative accuracy.

Package
Source

linear-algebra.lisp (file)

Function: spectral-factorization-w INSTANCE
Function: (setf spectral-factorization-w) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: spectral-factorization-z INSTANCE
Function: (setf spectral-factorization-z) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: svd-d INSTANCE
Function: (setf svd-d) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: svd-u INSTANCE
Function: (setf svd-u) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: svd-vt INSTANCE
Function: (setf svd-vt) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: xx LEFT-SQUARE-ROOT

Convenience function to create a matrix from a left square root.

Package
Source

factorizations.lisp (file)

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.4 Generic functions

Generic Function: cholesky A

Cholesky factorization.

Package
Source

linear-algebra.lisp (file)

Methods
Method: cholesky (A hermitian-matrix)
Generic Function: hermitian-factorization A

Compute the hermitian factorization.

Package
Source

linear-algebra.lisp (file)

Methods
Method: hermitian-factorization (A hermitian-matrix)
Generic Function: invert A &key TOLERANCE &allow-other-keys

Invert A. The inverse of matrix factorizations are other factorizations when appropriate, otherwise the result is a matrix. Usage note: inverting dense matrices is unnecessary and unwise in most cases, because it is numerically unstable. If you are solving many Ax=b equations with the same A, use a matrix factorization like LU.

Package
Source

linear-algebra.lisp (file)

Methods
Method: invert (DIAGONAL diagonal-matrix) &key TOLERANCE

For pseudoinverse, suppressing diagonal elements below TOLERANCE (if given, otherwise / is just used without any checking.

Method: invert (A cholesky) &key
Method: invert (A lower-triangular-matrix) &key
Method: invert (A upper-triangular-matrix) &key
Method: invert (A hermitian-matrix) &key
Method: invert (A hermitian-factorization) &key
Method: invert (LU lu) &key
Method: invert (A array) &key
Generic Function: invert-xx XX

Calculate (X^T X)-1 (which is used for calculating the variance of estimates) and return as a decomposition. Usually XX is a decomposition itself, eg QR returned by least squares. Note: this can be used to generate random draws, etc.

Package
Source

linear-algebra.lisp (file)

Methods
Method: invert-xx (QR qr)
Generic Function: left-square-root A

Return X such that XX^T=A.

Package
Source

factorizations.lisp (file)

Methods
Method: left-square-root (A diagonal-matrix)
Source

linear-algebra.lisp (file)

Method: left-square-root (HERMITIAN-MATRIX hermitian-matrix)
Source

linear-algebra.lisp (file)

Method: left-square-root (A matrix-square-root)
Generic Function: logdet MATRIX

Logarithm of the determinant of a matrix. Return -1, 1 or 0 (or equivalent) to correct for the sign, as a second value.

Package
Source

linear-algebra.lisp (file)

Methods
Method: logdet (MATRIX upper-triangular-matrix)
Method: logdet (MATRIX lower-triangular-matrix)
Method: logdet (MATRIX array)
Generic Function: lu A

LU decomposition of A

Package
Source

linear-algebra.lisp (file)

Methods
Method: lu (A array)
Generic Function: mm A B

Matrix multiplication of A and B.

Package
Source

linear-algebra.lisp (file)

Methods
Method: mm (A (eql t)) (B diagonal-matrix)
Method: mm (A diagonal-matrix) (B (eql t))
Method: mm (A diagonal-matrix) (B diagonal-matrix)
Method: mm (A diagonal-matrix) (B vector)
Method: mm (A vector) (B diagonal-matrix)
Method: mm (A array) (B diagonal-matrix)
Method: mm (A diagonal-matrix) (B array)
Method: mm (A (eql t)) (B vector)
Method: mm (A vector) (B (eql t))
Method: mm (A vector) (B vector)
Method: mm A (B wrapped-matrix)
Method: mm (A wrapped-matrix) B
Method: mm (A wrapped-matrix) (B wrapped-matrix)
Method: mm (A (eql t)) (B array)
Method: mm (A array) (B (eql t))
Method: mm (A array) (B array)
Method: mm A B
Generic Function: outer A B

Return the outer product column(a) row(b)^H. If either A or B is T, they are taken to be conjugate transposes of the other argument.

Package
Source

linear-algebra.lisp (file)

Methods
Method: outer (A vector) (B (eql t))
Method: outer (A (eql t)) (B vector)
Method: outer (A vector) (B vector)
Generic Function: qr OBJECT
Package
Methods
Method: qr (A array)
Source

linear-algebra.lisp (file)

Method: qr (QR qr)

matrix storing the QR factorization.

Source

factorizations.lisp (file)

Generic Function: right-square-root A

Return Y such that Y^T Y=A.

Efficiency note: decompositions should store the left square root X, and compute Y=X^T on demand, so getting X directly might be more efficient if you don’t need X^T.

Package
Source

factorizations.lisp (file)

Methods
Method: right-square-root (A matrix-square-root)
Method: right-square-root A
Generic Function: solve A B

Return X that solves AX=B. When B is a vector, so is X.

Package
Source

linear-algebra.lisp (file)

Methods
Method: solve (A diagonal-matrix) B
Method: solve (A upper-triangular-matrix) B
Method: solve (A lower-triangular-matrix) B
Method: solve (A hermitian-matrix) (B array)
Method: solve (A hermitian-factorization) (B array)
Method: solve (HERMITIAN-MATRIX hermitian-matrix) B
Method: solve (CHOLESKY cholesky) B
Method: solve (A array) (B array)
Method: solve (LU lu) (B array)
Method: solve A (B wrapped-matrix)
Generic Function: svd A &optional VECTORS

Return singular value decomposition A.

VECTORS determines how singular vectors are calculated:

- NIL sets U and VT to NIL
- :ALL makes U and VT square, with dimensions conforming to A
- :THIN makes the larger of U and VT rectangular. This means that not all of the singular vectors are calculates, and saves computational time when A is far from square.

Package
Source

linear-algebra.lisp (file)

Methods
Method: svd (A array) &optional VECTORS
Generic Function: tr A

Trace of a square matrix.

Package
Source

linear-algebra.lisp (file)

Methods
Method: tr (A array)
Method: tr (A wrapped-matrix)
Method: tr (A diagonal-matrix)

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.5 Conditions

Condition: lapack-error ()

The LAPACK procedure returned a nonzero info code.

Package
Source

conditions.lisp (file)

Direct superclasses

error (condition)

Direct subclasses
Condition: lapack-failure ()

Superclass of all LAPACK errors with a positive INFO

Package
Source

conditions.lisp (file)

Direct superclasses

lapack-error (condition)

Direct subclasses

lapack-singular-matrix (condition)

Direct slots
Slot: info

INFO corresponding to error message.

Initargs

:info

Condition: lapack-invalid-argument ()

An argument to a LAPACK procedure had an illegal value. It is very likely that this indicates a bug in LLA and should not happen.

Package
Source

conditions.lisp (file)

Direct superclasses
Direct slots
Slot: position

Position of the illegal argument

Initargs

:position

Condition: lapack-singular-matrix ()
Package
Source

conditions.lisp (file)

Direct superclasses

lapack-failure (condition)

Condition: lla-efficiency-warning ()
Package
Source

conditions.lisp (file)

Direct superclasses

warning (condition)

Direct subclasses
Condition: lla-efficiency-warning-array-conversion ()
Package
Source

conditions.lisp (file)

Direct superclasses

lla-efficiency-warning (condition)

Direct slots
Slot: array

The array that had to be copied.

Initargs

:array

Slot: type

Required element type.

Initargs

:type

Condition: lla-efficiency-warning-array-type ()

See *LLA-EFFICIENCY-WARNING-ARRAY-TYPE*.

Package
Source

conditions.lisp (file)

Direct superclasses

lla-efficiency-warning (condition)

Direct methods

print-object (method)

Direct slots
Slot: array
Initargs

:array

Condition: lla-incompatible-dimensions ()
Package
Source

conditions.lisp (file)

Direct superclasses

lapack-error (condition)

Condition: lla-internal-error ()

Internal error in LLA.

Package
Source

conditions.lisp (file)

Direct superclasses

error (condition)

Direct subclasses

lapack-invalid-argument (condition)

Direct slots
Slot: message
Initargs

:message

Initform

(quote "")

Condition: lla-unhandled-type ()

Could not classify object as a numeric type handled by LLA.

Package
Source

conditions.lisp (file)

Direct superclasses

error (condition)

Direct slots
Slot: object
Initform

(quote :object)

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.6 Structures

Structure: cholesky ()

Cholesky factorization a matrix.

Package
Source

factorizations.lisp (file)

Direct superclasses

matrix-square-root (structure)

Direct methods
Structure: matrix-square-root ()

General class for representing XX^T decompositions of matrices, regardless of how they were computed. The convention is to store X, the left square root.

Package
Source

factorizations.lisp (file)

Direct superclasses

structure-object (structure)

Direct subclasses

cholesky (structure)

Direct methods
Direct slots
Slot: left

matrix-square-root-left (function)

Writers

(setf matrix-square-root-left) (function)

Structure: spectral-factorization ()

Z W Z^T factorization of a Hermitian matrix, where the columns of Z contain the eigenvectors and W is a diagonal matrix of the eigenvalues. Z is a unitary matrix.

Package
Source

factorizations.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

as-array (method)

Direct slots
Slot: z

spectral-factorization-z (function)

Writers

(setf spectral-factorization-z) (function)

Slot: w

spectral-factorization-w (function)

Writers

(setf spectral-factorization-w) (function)

Structure: svd ()

Singular value decomposition. Singular values are in S, in descending order. U and VT may be NIL in case they are not computed.

Package
Source

factorizations.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

as-array (method)

Direct slots
Slot: u

svd-u (function)

Writers

(setf svd-u) (function)

Slot: d

svd-d (function)

Writers

(setf svd-d) (function)

Slot: vt

svd-vt (function)

Writers

(setf svd-vt) (function)

Next: , Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.7 Classes

Class: hermitian-factorization ()

Factorization for an indefinite hermitian matrix with pivoting.

Package
Source

factorizations.lisp (file)

Direct superclasses

ipiv-mixin (class)

Direct methods
Direct slots
Slot: factor

see documentation of *SYTRF and *HETRF, storage is
in the half specified by HERMITIAN-ORIENTATION and otherwise treated as opaque.

Initargs

:factor

factor (generic function)

Class: lu ()

LU factorization of a matrix with pivoting. (SLICE A IPIV) is (MM L U), when IPIV is used to obtain the permutation.

Package
Source

factorizations.lisp (file)

Direct superclasses

ipiv-mixin (class)

Direct methods
Direct slots
Slot: lu

matrix storing the transpose of the LU factorization.

Initargs

:lu

lu-matrix (generic function)

Class: qr ()

QR factorization of a matrix.

Package
Source

factorizations.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: qr

matrix storing the QR factorization.

Initargs

:qr

qr (generic function)

Slot: tau

complex scalar for elementary reflectors (see documentation of xGEQRF).

Initargs

:tau

tau (generic function)

Writers

(setf tau) (generic function)

Previous: , Up: Exported definitions   [Contents][Index]

#### 5.1.8 Types

Type: lla-complex-double ()
Package
Source

types.lisp (file)

Type: lla-complex-single ()
Package
Source

types.lisp (file)

Type: lla-double ()
Package
Source

types.lisp (file)

Type: lla-integer ()
Package
Source

types.lisp (file)

Type: lla-single ()
Package
Source

types.lisp (file)

Previous: , Up: Definitions   [Contents][Index]

### 5.2 Internal definitions

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.1 Constants

Constant: +complex-double+
Package
Source

types.lisp (file)

Constant: +complex-single+
Package
Source

types.lisp (file)

Constant: +double+
Package
Source

types.lisp (file)

Constant: +float-types+

List of all internal float types.

Package
Source

types.lisp (file)

Constant: +integer+
Package
Source

types.lisp (file)

Constant: +internal-types+

List of all internal types.

Package
Source

types.lisp (file)

Constant: +single+
Package
Source

types.lisp (file)

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.2 Symbol macros

Symbol Macro: &info
Package
Source

fortran-call.lisp (file)

Expansion

(lla::&info)

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.3 Macros

Macro: &array-in INPUT &key TYPE TRANSPOSE? FORCE-COPY?

Array which serves as an input. See FORTRAN-INPUT-ARRAY.

Package
Source

fortran-call.lisp (file)

Macro: &array-in/out (&key INPUT (TYPE INPUT-TYPE) (TRANSPOSE? INPUT-TRANSPOSE?) (FORCE-COPY? INPUT-FORCE-COPY?)) (&key OUTPUT (DIMENSIONS OUTPUT-DIMENSIONS) (TYPE OUTPUT-TYPE) (TRANSPOSE? OUTPUT-TRANSPOSE?))

Input/output array. See FORTRAN-INPUT-OUTPUT-ARRAY.

Package
Source

fortran-call.lisp (file)

Macro: &array-out OUTPUT &key DIMENSIONS TYPE TRANSPOSE?

Output array. See FORTRAN-OUTPUT-ARRAY.

Package
Source

fortran-call.lisp (file)

Macro: &atom VALUE &key TYPE OUTPUT

Atoms passed to FORTRAN. When not given, TYPE is inferred from the call’s default. VALUE is coerced to the desired type. When OUTPUT is given, value is read after the call and placed there.

Package
Source

fortran-call.lisp (file)

Macro: &char CHARACTER

Shorthand for character.

Package
Source

fortran-call.lisp (file)

Macro: &info &key CONDITION VARIABLE

Argument for checking whether the call was executed without an error. Automatically takes care of raising the appropriate condition if it wasn’t. CONDITION specifies the condition to raise in case of positive error codes, use NIL to ignore these. VARIABLE can be used to specify

Package
Source

fortran-call.lisp (file)

Macro: &integer VALUE &key OUTPUT

Shorthand for integer atom.

Package
Source

fortran-call.lisp (file)

Macro: &integers &rest VALUES

Shorthand for integer atoms (which are not modified). Useful for combining arguments.

Package
Source

fortran-call.lisp (file)

Macro: &new VARIABLE

Placeholder macro for newly allocated output variables. Using (&NEW VARIABLE) allocates a new array within the scope of the outer macro, and is usually used for output. See &ARRAY-OUT and &ARRAY-IN/OUT.

Package
Source

fortran-call.lisp (file)

Macro: &work SIZE &optional TYPE

Allocate a work area of SIZE. When TYPE is not given, the call’s default is used.

Package
Source

fortran-call.lisp (file)

Macro: &work-query &optional TYPE

Work area query, takes the place of TWO fortran arguments.

Package
Source

fortran-call.lisp (file)

Macro: array-clause% (ARRAY INTERNAL-TYPE CLAUSE-ELEMENT-TYPE CLAUSE-INTERNAL-TYPE) &body BODY

Macro that generates a lambda form that can bed used in EXPAND-SPECIFICATIONS%.

Package
Source

foreign-memory.lisp (file)

Macro: blas-call (NAME TYPE &optional VALUE RETURN-TYPES) &body FORMS

BLAS call. NAME is either a string or a list of two strings (real/complex). TYPE (internal-type) selects the function to call. VALUE is the form returned after the call.

Package
Source

fortran-call.lisp (file)

Macro: define-factorization-eops% TYPE CONVERSION

Define elementwise operations for TYPE, trying to convert into arrays.

Package
Source

factorizations.lisp (file)

Macro: define-foreign-aref ()
Package
Source

foreign-memory.lisp (file)

Macro: define-matrix-square-root-scalar-multiplication TYPE &key MAKE
Package
Source

factorizations.lisp (file)

Macro: lapack-call (NAME TYPE VALUE) &body FORMS

LAPACK call, takes an &info argument. NAME is either a string or a list of two strings (real/complex). TYPE (internal-type) selects the function to call. VALUE is the form returned after the call.

Package
Source

fortran-call.lisp (file)

Macro: lapack-call-w/query (NAME TYPE VALUE) &body FORMS

LAPACK call which also takes &work-query arguments (in place of two FORTRAN arguments).

Package
Source

fortran-call.lisp (file)

Macro: log-with-sign% VALUE SIGN-CHANGES BLOCK-NAME

Log of (ABS VALUE), increments SIGN-CHANGES when negative, return-from block-name (values nil 0) when zero.

Package
Source

linear-algebra.lisp (file)

Macro: with-array-input ((POINTER &optional COPIED?) ARRAY INTERNAL-TYPE TRANSPOSE? FORCE-COPY?) &body BODY

Ensure that ARRAY is mapped to a corresponding memory area for the duration of BODY (see below for details of semantics). POINTER is bound to the start of the memory address. The representation of values in the memory is determined by INTERNAL-TYPE. When TRANSPOSE?, transpose the array before BODY (only works for matrices, otherwise signal an error).

If FORCE-COPY? is false, POINTER may or may not point to the memory backing ARRAY.

If FORCE-COPY? is true, POINTER always points to a copy of the contents of ARRAY.

COPIED? is bound to indicate whether POINTER points to a copy or the actual array contents.

The value of the expression is always the value of BODY.

Package
Source

pinned-array.lisp (file)

Macro: with-array-input-output ((POINTER &optional COPIED?) INPUT-ARRAY INPUT-INTERNAL-TYPE INPUT-TRANSPOSE? INPUT-FORCE-COPY? OUTPUT-ARRAY OUTPUT-INTERNAL-TYPE OUTPUT-TRANSPOSE?) &body BODY

Similar to WITH-ARRAY-INPUT, it also ensures that OUTPUT-ARRAY contains the contents the memory area pointed to by POINTER when BODY is finished. If OUTPUT-ARRAY is NIL then it is equivalent to WITH-ARRAY-INPUT.

Package
Source

pinned-array.lisp (file)

Macro: with-array-output ((POINTER &optional COPIED?) ARRAY INTERNAL-TYPE TRANSPOSE?) &body BODY

Ensure that ARRAY is mapped to a corresponding memory area for the duration of BODY (see below for details of semantics). POINTER is bound to the start of the memory address. The representation of values in the memory is determined by INTERNAL-TYPE. When TRANSPOSE?, transpose the array after BODY (only works for matrices, otherwise signal an error).

COPIED? is bound to indicate whether POINTER points to a copy or the actual array contents.

The value of the expression is always the value of BODY.

Package
Source

pinned-array.lisp (file)

Macro: with-fortran-atom (POINTER VALUE TYPE OUTPUT) &body BODY

Allocate memory for internal TYPE and set it to VALUE for body, which can use POINTER to access it. When OUTPUT is given, the value is assigned to it after BODY. The atom is automatically coerced to the correct type (by FOREIGN-AREF).

Package
Source

foreign-memory.lisp (file)

Macro: with-fortran-character (POINTER CHARACTER) &body BODY

Make character available in an allocated memory area at POINTER for BODY.

Package
Source

foreign-memory.lisp (file)

Macro: with-pinned-array (POINTER ARRAY) &body BODY
Package
Source

pinned-array.lisp (file)

Macro: with-work-area (POINTER INTERNAL-TYPE SIZE) &body BODY

Allocate a work area of SIZE and INTERNAL-TYPE, and bind the POINTER to its start during BODY.

Package
Source

pinned-array.lisp (file)

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.4 Functions

Function: absolute-square-type INTERNAL-TYPE

Type of (* x (conjugate x)).

Package
Source

types.lisp (file)

Function: all-from-specifications% ()

Return an optimization specification for all functions that copy from foreign memory.

Package
Source

foreign-memory.lisp (file)

Function: all-to-specifications% ()

Return an optimization specification for all functions that copy to foreign memory.

Package
Source

foreign-memory.lisp (file)

Function: argument-pointers ARGUMENTS

Return the list of pointers for all the arguments.

Package
Source

fortran-call.lisp (file)

Function: arguments-for-cffi ARGUMENTS

Return a list that can be use in a CFFI call.

Package
Source

fortran-call.lisp (file)

Function: array-float-type ARRAY

Return an (internal) float type for an array. O(1) when the type can be detected from the specialized array element type, O(n) otherwise.

Package
Source

types.lisp (file)

Function: assert-single-lapack-info ARGUMENTS

Assert that there is at most one LAPACK-INFO in ARGUMENTS.

Package
Source

fortran-call.lisp (file)

Function: backing-array ARRAY

Return the array in which the contents of ARRAY are stored. For simple arrays, this is always the array itself. The second value is the displacement.

Package
Source

pinned-array.lisp (file)

Function: blas-lapack-call-form TYPE-VAR NAME ARGUMENTS &optional RETURN-TYPES

Return a form BLAS/LAPACK calls, conditioning on TYPE-VAR. See BLAS-LAPACK-FUNCTION-NAME for the interpretation of FIXME

Package
Source

fortran-call.lisp (file)

Function: blas-lapack-function-name TYPE NAME

Return the BLAS/LAPACK foreign function name. TYPE is the internal type, NAME is one of the following: NAME, (NAME), which are used for both complex and real names, or (REAL-NAME COMPLEX-NAME).

Package
Source

fortran-call.lisp (file)

Function: blas-return-types RETURN-TYPES
Package
Source

fortran-call.lisp (file)

Function: cholesky-left INSTANCE
Function: (setf cholesky-left) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: cholesky-p OBJECT
Package
Source

factorizations.lisp (file)

Function: common-float-type &rest ARRAYS-OR-NUMBERS

Return the common (internal) float type for the arguments.

Package
Source

types.lisp (file)

Function: complex? INTERNAL-TYPE

True iff the internal type is complex.

Package
Source

types.lisp (file)

Function: copy-array-from-memory ARRAY POINTER INTERNAL-TYPE

Copy the memory area of type INTERNAL-TYPE at POINTER to ARRAY.

Package
Source

foreign-memory.lisp (file)

Function: copy-array-to-memory ARRAY POINTER INTERNAL-TYPE

Copy the contents of ARRAY to the memory area of type INTERNAL-TYPE at POINTER.

Package
Source

foreign-memory.lisp (file)

Function: copy-cholesky INSTANCE
Package
Source

factorizations.lisp (file)

Function: copy-matrix-square-root INSTANCE
Package
Source

factorizations.lisp (file)

Function: copy-spectral-factorization INSTANCE
Package
Source

factorizations.lisp (file)

Function: copy-svd INSTANCE
Package
Source

factorizations.lisp (file)

Function: count-permutations% IPIV-INTERNAL

Count the permutations in a pivoting vector.

Package
Source

factorizations.lisp (file)

Function: create-array-from-memory POINTER INTERNAL-TYPE DIMENSIONS &optional ELEMENT-TYPE

Create an array from contents at POINTER.

Package
Source

foreign-memory.lisp (file)

Function: create-transposed-matrix-from-memory POINTER INTERNAL-TYPE DIMENSIONS &optional ELEMENT-TYPE

Create a matrix from transposed contents at POINTER.

Package
Source

foreign-memory.lisp (file)

Function: default-libraries ()

Return a list of libraries. The source conditions on the platform, relying TRIVIAL-FEATURES. This function is only called when the libraries were not configured by the user, see the documentation on how to do that.

Package
Source

configuration.lisp (file)

Function: diagonal-log-sum% MATRIX &optional SIGN-CHANGES

Sum of the log of the elements in the diagonal. Sign-changes counts the negative values, and may be started at something else than 0 (eg in case of pivoting). Return (values NIL 0) in case of encountering a 0.

Package
Source

linear-algebra.lisp (file)

Function: dimensions-as-matrix ARRAY ORIENTATION

If ARRAY is a vector, return its dimensions as a matrix with given ORIENTATION (:ROW or :COLUMN) as multiple values, and T as the third value. If it is matrix, just return the dimensions and NIL. Used for considering vectors as conforming matrices (eg see MM).

Package
Source

linear-algebra.lisp (file)

Function: epsilon INTERNAL-TYPE

Return the float epsilon for the given internal float type.

Package
Source

types.lisp (file)

Function: expand-specifications% CLAUSE SPECIFICATIONS

Expand specifications using (clause internal-type element-type).

Package
Source

foreign-memory.lisp (file)

Function: foreign-size TYPE

Return the size of an internal type in bytes.

Package
Source

foreign-memory.lisp (file)

Function: fortran-argument/new-variable FORM

If FORM is (&NEW VARIABLE), return VARIABLE, otherwise NIL.

Package
Source

fortran-call.lisp (file)

Function: invert-triangular% A UPPER? UNIT-DIAG?

Invert a dense (triangular) matrix using the LAPACK routine *TRTRI. UPPER? indicates if the matrix is in the upper or the lower triangle of a matrix, UNIT-DIAG? indicates whether the diagonal is supposed to consist of 1s. For internal use, not exported.

Package
Source

linear-algebra.lisp (file)

Function: lapack-info-wrap-argument ARGUMENT BODY

Generate a wrapper for a LAPACK INFO argument, also checking the result and raising a condition if applicable. Useful for WRAP-ARGUMENT.

Package
Source

fortran-call.lisp (file)

Function: last-rows-ss MATRIX NRHS COMMON-TYPE

Calculate the sum of squares of the last rows of MATRIX columnwise,
omitting the first NRHS rows. If MATRIX is a vector, just do this for the last elements. Used for interfacing with xGELS.

Package
Source

linear-algebra.lisp (file)

Function: least-squares-qr Y X &key &allow-other-keys

Least squares using QR decomposition. Additional values returned: the QR decomposition of X. See LEAST-SQUARES for additional documentation. Usage note: SVD-based methods are recommended over this one, unless X is well-conditioned.

Package
Source

linear-algebra.lisp (file)

Function: lisp-type INTERNAL-TYPE
Package
Source

types.lisp (file)

Function: make-cholesky LEFT
Package
Source

factorizations.lisp (file)

Function: make-cholesky% LEFT
Package
Source

factorizations.lisp (file)

Function: make-matrix-square-root LEFT
Package
Source

factorizations.lisp (file)

Function: make-spectral-factorization &key (Z Z) (W W)
Package
Source

factorizations.lisp (file)

Function: make-svd &key (U U) (D D) (VT VT)
Package
Source

factorizations.lisp (file)

Function: matrix-square-root-left INSTANCE
Function: (setf matrix-square-root-left) VALUE INSTANCE
Package
Source

factorizations.lisp (file)

Function: matrix-square-root-p OBJECT
Package
Source

factorizations.lisp (file)

Function: maybe-default-type TYPE PARAMETERS

Return default type from PARAMETERS when TYPE is NIL.

Package
Source

fortran-call.lisp (file)

Function: mm-hermitian% A TRANSPOSE-LEFT?

Calculate A*op(A) if TRANSPOSE-LEFT? is NIL, and op(A)*A otherwise. op() is always conjugate transpose, but may be implemented as a transpose if A is real, in which case the two are equivalent. This function is meant to be used internally, and is not exported.

Package
Source

linear-algebra.lisp (file)

Function: number-float-type NUMBER

Return an (internal) float type for a number.

Package
Source

types.lisp (file)

Function: output-array-form FORM

Return a form that can be passed to WITH-OUTPUT-ARRAY (or similar) as an output. The variable is extracted from &NEW forms, otherwise the form is passed as is.

Package
Source

fortran-call.lisp (file)

Function: process-forms FORMS ENVIRONMENT

Process forms and return a list of argument specifications. A form may correspond to multiple arguments.

Package
Source

fortran-call.lisp (file)

Function: query-configuration INDICATOR &optional DEFAULT

Return the property for INDICATOR from the configuration variable, with an optional default, which can be a function (called on demand).

Package
Source
Function: set-feature SYMBOL SET?

Ensure that symbol is in *FEATURES* iff SET?. Returns no values.

Package
Source
Function: shareable-array? ARRAY INTERNAL-TYPE
Package
Source

pinned-array.lisp (file)

Function: spectral-factorization-p OBJECT
Package
Source

factorizations.lisp (file)

Function: sum-diagonal% ARRAY

Sum diagonal of array, checking that it is square.

Package
Source

linear-algebra.lisp (file)

Function: svd-p OBJECT
Package
Source

factorizations.lisp (file)

Function: transpose-matrix-from-memory MATRIX POINTER INTERNAL-TYPE

Transpose the contents of ARRAY to the memory area of type INTERNAL-TYPE at POINTER. VECTORs are also handled.

Package
Source

foreign-memory.lisp (file)

Function: transpose-matrix-to-memory MATRIX POINTER INTERNAL-TYPE

Transpose the contents of ARRAY to the memory area of type INTERNAL-TYPE at POINTER. VECTORs are also handled.

Package
Source

foreign-memory.lisp (file)

Function: trsm% A A-UPPER? B

Wrapper for BLAS routine xTRSM. Solve AX=B, where A is triangular.

Package
Source

linear-algebra.lisp (file)

Function: value-from-memory% INTERNAL-TYPE

Return a (LAMBDA (POINTER INDEX) ...) form that can be used to read an element from an array in memory.

Package
Source

foreign-memory.lisp (file)

Function: value-to-memory% INTERNAL-TYPE

Return a (LAMBDA (POINTER INDEX VALUE) ...) form that can be used to write an element to an array in memory.

Package
Source

foreign-memory.lisp (file)

Function: wrap-arguments ARGUMENTS PASS PARAMETERS BODY

Wrap BODY in arguments. Convenience function used to implement the expansion.

Package
Source

fortran-call.lisp (file)

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.5 Generic functions

Generic Function: argument-pointer OBJECT
Package
Methods
Method: argument-pointer (FORTRAN-ARGUMENT fortran-argument)

Pointer passed to FORTRAN.

Source

fortran-call.lisp (file)

Generic Function: factor OBJECT
Package
Methods
Method: factor (HERMITIAN-FACTORIZATION hermitian-factorization)

see documentation of *SYTRF and *HETRF, storage is
in the half specified by HERMITIAN-ORIENTATION and otherwise treated as opaque.

Source

factorizations.lisp (file)

Generic Function: fortran-argument/output-initializer-form ARGUMENT PARAMETERS

When applicable, return a form that is used to initialize the OUTPUT variable. When NIL is returned, no binding is established.

Package
Source

fortran-call.lisp (file)

Methods
Method: fortran-argument/output-initializer-form (ARGUMENT fortran-input-output-array) PARAMETERS
Method: fortran-argument/output-initializer-form (ARGUMENT fortran-output-array) PARAMETERS
Method: fortran-argument/output-initializer-form (ARGUMENT fortran-argument/output) PARAMETERS
Generic Function: ipiv-internal OBJECT
Package
Methods
Method: ipiv-internal (IPIV-MIXIN ipiv-mixin)

pivot indices in LAPACK’s representation, counting from 1

Source

factorizations.lisp (file)

Generic Function: lu-matrix OBJECT
Package
Methods
Method: lu-matrix (LU lu)

matrix storing the transpose of the LU factorization.

Source

factorizations.lisp (file)

Generic Function: permutations OBJECT

Return the number of permutations in object (which is usually a matrix factorization, or a pivot index.

Package
Source

factorizations.lisp (file)

Methods
Method: permutations (LU lu)
Generic Function: process-form FORM ENVIRONMENT

Return a list of argument specifications (atoms are converted into lists).

The code in this file defines a DSL for calling BLAS and LAPACK procedures in FORTRAN, which expect pointers to memory locations. The high-level macros BLAS-CALL and LAPACK-CALL take care of pinning arrays or allocating memory and copying array contents (when applicable), and use PROCESS-FORM to interpret their arguments, which correspond to one or more FORTRAN arguments. These are then expanded into code using WRAP-ARGUMENT.

Package
Source

fortran-call.lisp (file)

Methods
Method: process-form (FORM (eql 1)) ENV
Method: process-form (FORM (eql 0)) ENV
Method: process-form (FORM character) ENV
Method: process-form (FORM null) ENVIRONMENT
Method: process-form FORM ENVIRONMENT
Generic Function: tau OBJECT
Generic Function: (setf tau) NEW-VALUE OBJECT
Package
Methods
Method: tau (QR qr)
Method: (setf tau) NEW-VALUE (QR qr)

complex scalar for elementary reflectors (see documentation of xGEQRF).

Source

factorizations.lisp (file)

Generic Function: wrap-argument ARGUMENT PASS PARAMETERS BODY

Return BODY wrapped in an environment generated for ARGUMENT in a given PASS.

The code for calling the function is built using nested calls of WRAP-ARGUMENT. The setup is somewhat complicated because some functions require that they are called twice (eg in order to calculate work area size), and we don’t necessarily want to allocate and free memory twice. Because of this, expansions take place in ’passes’.

Currently, the following passes are used:

- BINDINGS: establishes the bindings (also empty variables)

- MAIN: for arguments that are the same regardless of what kind of call is made

- QUERY: for querying work area sizes

- CALL: the actual function call

PARAMETERS is used to specify information that is applicable for all arguments (eg a default array element type).

Package
Source

fortran-call.lisp (file)

Methods
Method: wrap-argument (ARGUMENT lapack-work-query-size) (PASS (eql call)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT lapack-work-query-area) (PASS (eql call)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT lapack-work-query-size) (PASS (eql query)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT lapack-work-query-area) (PASS (eql query)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT lapack-work-query-area) (PASS (eql bindings)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT lapack-info) (PASS (eql query)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT lapack-info) (PASS (eql call)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-work-area) (PASS (eql main)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-input-output-array) (PASS (eql main)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-output-array) (PASS (eql main)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-input-array) (PASS (eql main)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-atom) (PASS (eql main)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-character) (PASS (eql main)) PARAMETERS BODY
Method: wrap-argument (ARGUMENT fortran-argument/output) (PASS (eql bindings)) PARAMETERS BODY
Method: wrap-argument ARGUMENT PASS PARAMETERS BODY

Next: , Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.6 Classes

Class: fortran-argument ()

Superclass of all arguments with pointers.

Package
Source

fortran-call.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods

argument-pointer (method)

Direct slots
Slot: pointer

Pointer passed to FORTRAN.

Initargs

:pointer

Initform

(gensym)

argument-pointer (generic function)

Class: fortran-argument/output ()

Class for arguments that return an output. When FORTRAN-ARGUMENT/OUTPUT-INITIALIZER-FORM returns non-NIL, a local binding of OUTPUT to this form will be wrapped around the relevant BODY. Also see &NEW.

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument (class)

Direct subclasses
Direct methods
Direct slots
Slot: output

Lisp variable or initialization form mapped to an output.

Initargs

:output

Class: fortran-argument/size ()

Number of elements in array mapped to a pointer.

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument (class)

Direct subclasses
Direct slots
Slot: size

Number of elements.

Initargs

:size

Class: fortran-argument/type ()

For arguments which may have multiple types, mostly arrays or atoms (implemented as single-cell arrays).

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument (class)

Direct subclasses
Direct slots
Slot: type

Determines (internal) type for array mapped to the pointer.

Initargs

:type

Class: fortran-atom ()

Atoms passed to FORTRAN. Input/output (when OUTPUT is given).

Package
Source

fortran-call.lisp (file)

Direct superclasses
Direct methods

wrap-argument (method)

Direct slots
Slot: value
Initargs

:value

Class: fortran-character ()

Character passed to FORTRAN. Input only, for specifying triangle orientation, etc.

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument (class)

Direct methods

wrap-argument (method)

Direct slots
Slot: character
Initargs

:character

Class: fortran-input-array ()

Arrays which serve as inputs. See WITH-ARRAY-INPUT for the semantics of the arguments.

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument (class)

Direct subclasses

fortran-input-output-array (class)

Direct methods

wrap-argument (method)

Direct slots
Slot: input
Initargs

:input

Slot: input-type
Initargs

:input-type

Slot: input-transpose?
Initargs

:input-transpose?

Slot: input-force-copy?
Initargs

:input-force-copy?

Class: fortran-input-output-array ()

Input/output array. See WITH-ARRAY-INPUT-OUTPUT for the semantics of the arguments.

Package
Source

fortran-call.lisp (file)

Direct superclasses
Direct methods
Class: fortran-output-array ()

Output array. See WITH-ARRAY-OUTPUT for the semantics of the arguments.

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument/output (class)

Direct subclasses

fortran-input-output-array (class)

Direct methods
Direct slots
Slot: output
Initargs

:output

Slot: output-dimensions
Initargs

:output-dimensions

Slot: output-type
Initargs

:output-type

Slot: output-transpose?
Initargs

:output-transpose?

Class: fortran-work-area ()

Work area.

Package
Source

fortran-call.lisp (file)

Direct superclasses
Direct methods

wrap-argument (method)

Class: ipiv-mixin ()

Mixin class for objects with pivoting.

Package
Source

factorizations.lisp (file)

Direct superclasses

standard-object (class)

Direct subclasses
Direct methods

ipiv-internal (method)

Direct slots
Slot: ipiv-internal

pivot indices in LAPACK’s representation, counting from 1

Type

vector

Initargs

:ipiv-internal

ipiv-internal (generic function)

Class: lapack-info ()

Information from a LAPACK call. See the LAPACK manual for error codes.

Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument (class)

Direct methods
Direct slots
Slot: condition
Initargs

:condition

Slot: variable
Initargs

:variable

Class: lapack-work-query-area ()
Package
Source

fortran-call.lisp (file)

Direct superclasses
Direct methods
Class: lapack-work-query-size ()
Package
Source

fortran-call.lisp (file)

Direct superclasses

fortran-argument/size (class)

Direct methods

Previous: , Up: Internal definitions   [Contents][Index]

#### 5.2.7 Types

Type: float-type ()
Package
Source

types.lisp (file)

Type: internal-type ()
Package
Source

types.lisp (file)

Type: maximum-array-size ()
Package
Source

foreign-memory.lisp (file)

Previous: , Up: Top   [Contents][Index]

## Appendix A Indexes

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.1 Concepts

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.2 Functions

Jump to: &   (   A   B   C   D   E   F   G   H   I   L   M   N   O   P   Q   R   S   T   V   W   X
Jump to: &   (   A   B   C   D   E   F   G   H   I   L   M   N   O   P   Q   R   S   T   V   W   X

Next: , Previous: , Up: Indexes   [Contents][Index]

### A.3 Variables

Jump to: &   *   +   A   C   D   F   I   L   M   O   P   Q   S   T   U   V   W   Z
Jump to: &   *   +   A   C   D   F   I   L   M   O   P   Q   S   T   U   V   W   Z

Previous: , Up: Indexes   [Contents][Index]

### A.4 Data types

Jump to: C   F   H   I   L   M   P   Q   S   T
Jump to: C   F   H   I   L   M   P   Q   S   T