This is the lla Reference Manual, version 0.3.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:57:14 2024 GMT+0.
lla/lla.asd
lla/package.lisp
lla/configuration-interface.lisp
lla/configuration.lisp
lla/libraries.lisp
lla/conditions.lisp
lla/types.lisp
lla/foreign-memory.lisp
lla/pinned-array.lisp
lla/factorizations.lisp
lla/fortran-call.lisp
lla/linear-algebra.lisp
lla/blas.lisp
The main system appears first, followed by any subsystem dependency.
lla
Lisp Linear Algebra
Steven Nunez
ML-PL
LLA is a high-level Common Lisp library built on on BLAS and LAPACK, but providing a more abstract interface with the purpose of freeing the user from low-level concerns and reducing the number of bugs in numerical code.
There are four main objectives:
- Provide a high-level, user friendly, interface that hides the details.
- Stay in Lisp and expose the innards of the objects as much as possible.
- Keeping it simple; LLA is only about 3000 lines of code.
- Speed is important, but reliability comes first.
0.3.1
anaphora
(system).
alexandria
(system).
cffi
(system).
num-utils
(system).
select
(system).
let-plus
(system).
package.lisp
(file).
configuration-interface.lisp
(file).
configuration.lisp
(file).
libraries.lisp
(file).
conditions.lisp
(file).
types.lisp
(file).
foreign-memory.lisp
(file).
pinned-array.lisp
(file).
factorizations.lisp
(file).
fortran-call.lisp
(file).
linear-algebra.lisp
(file).
blas.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
lla/lla.asd
lla/package.lisp
lla/configuration-interface.lisp
lla/configuration.lisp
lla/libraries.lisp
lla/conditions.lisp
lla/types.lisp
lla/foreign-memory.lisp
lla/pinned-array.lisp
lla/factorizations.lisp
lla/fortran-call.lisp
lla/linear-algebra.lisp
lla/blas.lisp
lla/configuration-interface.lisp
package.lisp
(file).
lla
(system).
query-configuration
(function).
set-feature
(function).
lla/configuration.lisp
configuration-interface.lisp
(file).
lla
(system).
default-libraries
(function).
lla/libraries.lisp
configuration.lisp
(file).
lla
(system).
lla/conditions.lisp
libraries.lisp
(file).
lla
(system).
*lla-efficiency-warning-array-conversion*
(special variable).
*lla-efficiency-warning-array-type*
(special variable).
lapack-error
(condition).
lapack-failure
(condition).
lapack-invalid-argument
(condition).
lapack-singular-matrix
(condition).
lla-efficiency-warning
(condition).
lla-efficiency-warning-array-conversion
(condition).
lla-efficiency-warning-array-type
(condition).
lla-incompatible-dimensions
(condition).
lla-internal-error
(condition).
lla-unhandled-type
(condition).
print-object
(method).
lla/types.lisp
conditions.lisp
(file).
lla
(system).
lla-complex-double
(type).
lla-complex-single
(type).
lla-double
(type).
lla-integer
(type).
lla-single
(type).
+complex-double+
(constant).
+complex-single+
(constant).
+double+
(constant).
+float-types+
(constant).
+integer+
(constant).
+internal-types+
(constant).
+single+
(constant).
absolute-square-type
(function).
array-float-type
(function).
common-float-type
(function).
complex?
(function).
epsilon
(function).
float-type
(type).
internal-type
(type).
lisp-type
(function).
number-float-type
(function).
lla/foreign-memory.lisp
types.lisp
(file).
lla
(system).
all-from-specifications%
(function).
all-to-specifications%
(function).
array-clause%
(macro).
copy-array-from-memory
(function).
copy-array-to-memory
(function).
create-array-from-memory
(function).
create-transposed-matrix-from-memory
(function).
define-foreign-aref
(macro).
expand-specifications%
(function).
foreign-size
(function).
maximum-array-size
(type).
transpose-matrix-from-memory
(function).
transpose-matrix-to-memory
(function).
value-from-memory%
(function).
value-to-memory%
(function).
with-fortran-atom
(macro).
with-fortran-character
(macro).
lla/pinned-array.lisp
foreign-memory.lisp
(file).
lla
(system).
backing-array
(function).
shareable-array?
(function).
with-array-input
(macro).
with-array-input-output
(macro).
with-array-output
(macro).
with-pinned-array
(macro).
with-work-area
(macro).
lla/factorizations.lisp
pinned-array.lisp
(file).
lla
(system).
cholesky
(structure).
e2*
(method).
e2*
(method).
e2+
(method).
e2+
(method).
e2/
(method).
hermitian-factorization
(class).
ipiv
(function).
ipiv-inverse
(function).
left-square-root
(generic function).
lu
(class).
lu-l
(function).
lu-u
(function).
matrix-square-root
(structure).
print-object
(method).
qr
(reader method).
qr
(class).
qr-r
(function).
right-square-root
(generic function).
spectral-factorization
(structure).
spectral-factorization-w
(reader).
(setf spectral-factorization-w)
(writer).
spectral-factorization-z
(reader).
(setf spectral-factorization-z)
(writer).
svd
(structure).
svd-d
(reader).
(setf svd-d)
(writer).
svd-u
(reader).
(setf svd-u)
(writer).
svd-vt
(reader).
(setf svd-vt)
(writer).
xx
(function).
cholesky-left
(function).
(setf cholesky-left)
(function).
cholesky-p
(function).
copy-cholesky
(function).
copy-matrix-square-root
(function).
copy-spectral-factorization
(function).
copy-svd
(function).
count-permutations%
(function).
define-factorization-eops%
(macro).
define-matrix-square-root-scalar-multiplication
(macro).
factor
(reader method).
ipiv-internal
(reader method).
ipiv-mixin
(class).
lu-matrix
(reader method).
make-cholesky
(function).
make-cholesky%
(function).
make-matrix-square-root
(function).
make-spectral-factorization
(function).
make-svd
(function).
matrix-square-root-left
(reader).
(setf matrix-square-root-left)
(writer).
matrix-square-root-p
(function).
permutations
(generic function).
spectral-factorization-p
(function).
svd-p
(function).
tau
(reader method).
(setf tau)
(writer method).
lla/fortran-call.lisp
factorizations.lisp
(file).
lla
(system).
with-fp-traps-masked
(macro).
&array-in
(macro).
&array-in/out
(macro).
&array-out
(macro).
&atom
(macro).
&char
(macro).
&info
(symbol macro).
&info
(macro).
&integer
(macro).
&integers
(macro).
&new
(macro).
&work
(macro).
&work-query
(macro).
argument-pointer
(reader method).
argument-pointers
(function).
arguments-for-cffi
(function).
assert-single-lapack-info
(function).
blas-call
(macro).
blas-lapack-call-form
(function).
blas-lapack-function-name
(function).
blas-return-types
(function).
fortran-argument
(class).
fortran-argument/new-variable
(function).
fortran-argument/output
(class).
fortran-argument/output-initializer-form
(generic function).
fortran-argument/size
(class).
fortran-argument/type
(class).
fortran-atom
(class).
fortran-character
(class).
fortran-input-array
(class).
fortran-input-output-array
(class).
fortran-output-array
(class).
fortran-work-area
(class).
lapack-call
(macro).
lapack-call-w/query
(macro).
lapack-info
(class).
lapack-info-wrap-argument
(function).
lapack-work-query-area
(class).
lapack-work-query-size
(class).
maybe-default-type
(function).
output-array-form
(function).
process-form
(generic function).
process-forms
(function).
wrap-argument
(generic function).
wrap-arguments
(function).
lla/linear-algebra.lisp
fortran-call.lisp
(file).
lla
(system).
as-array
(method).
as-array
(method).
as-array
(method).
cholesky
(generic function).
det
(function).
eigenvalues
(function).
hermitian-factorization
(generic function).
invert
(generic function).
invert-xx
(generic function).
least-squares
(function).
left-square-root
(method).
left-square-root
(method).
logdet
(generic function).
lu
(generic function).
mm
(generic function).
mmm
(function).
outer
(generic function).
qr
(method).
solve
(generic function).
spectral-factorization
(function).
svd
(generic function).
tr
(generic function).
diagonal-log-sum%
(function).
dimensions-as-matrix
(function).
invert-triangular%
(function).
last-rows-ss
(function).
least-squares-qr
(function).
log-with-sign%
(macro).
mm-hermitian%
(function).
sum-diagonal%
(function).
trsm%
(function).
Packages are listed by definition order.
lla
alexandria
.
anaphora
.
cffi
.
common-lisp
.
let-plus
.
num-utils
.
select
.
*lla-efficiency-warning-array-conversion*
(special variable).
*lla-efficiency-warning-array-type*
(special variable).
asum
(function).
axpy!
(function).
cholesky
(generic function).
cholesky
(structure).
copy!
(function).
det
(function).
dot
(function).
eigenvalues
(function).
gemm!
(function).
hermitian-factorization
(generic function).
hermitian-factorization
(class).
invert
(generic function).
invert-xx
(generic function).
ipiv
(function).
ipiv-inverse
(function).
lapack-error
(condition).
lapack-failure
(condition).
lapack-invalid-argument
(condition).
lapack-singular-matrix
(condition).
least-squares
(function).
left-square-root
(generic function).
lla-complex-double
(type).
lla-complex-single
(type).
lla-double
(type).
lla-efficiency-warning
(condition).
lla-efficiency-warning-array-conversion
(condition).
lla-efficiency-warning-array-type
(condition).
lla-incompatible-dimensions
(condition).
lla-integer
(type).
lla-internal-error
(condition).
lla-single
(type).
lla-unhandled-type
(condition).
logdet
(generic function).
lu
(generic function).
lu
(class).
lu-l
(function).
lu-u
(function).
matrix-square-root
(structure).
mm
(generic function).
mmm
(function).
nrm2
(function).
outer
(generic function).
qr
(generic function).
qr
(class).
qr-r
(function).
right-square-root
(generic function).
scal!
(function).
solve
(generic function).
spectral-factorization
(function).
spectral-factorization
(structure).
spectral-factorization-w
(reader).
(setf spectral-factorization-w)
(writer).
spectral-factorization-z
(reader).
(setf spectral-factorization-z)
(writer).
svd
(generic function).
svd
(structure).
svd-d
(reader).
(setf svd-d)
(writer).
svd-u
(reader).
(setf svd-u)
(writer).
svd-vt
(reader).
(setf svd-vt)
(writer).
tr
(generic function).
with-fp-traps-masked
(macro).
xx
(function).
&array-in
(macro).
&array-in/out
(macro).
&array-out
(macro).
&atom
(macro).
&char
(macro).
&info
(symbol macro).
&info
(macro).
&integer
(macro).
&integers
(macro).
&new
(macro).
&work
(macro).
&work-query
(macro).
+complex-double+
(constant).
+complex-single+
(constant).
+double+
(constant).
+float-types+
(constant).
+integer+
(constant).
+internal-types+
(constant).
+single+
(constant).
absolute-square-type
(function).
all-from-specifications%
(function).
all-to-specifications%
(function).
argument-pointer
(generic reader).
argument-pointers
(function).
arguments-for-cffi
(function).
array-clause%
(macro).
array-float-type
(function).
assert-single-lapack-info
(function).
backing-array
(function).
blas-call
(macro).
blas-lapack-call-form
(function).
blas-lapack-function-name
(function).
blas-return-types
(function).
cholesky-left
(function).
(setf cholesky-left)
(function).
cholesky-p
(function).
common-float-type
(function).
complex?
(function).
copy-array-from-memory
(function).
copy-array-to-memory
(function).
copy-cholesky
(function).
copy-matrix-square-root
(function).
copy-spectral-factorization
(function).
copy-svd
(function).
count-permutations%
(function).
create-array-from-memory
(function).
create-transposed-matrix-from-memory
(function).
default-libraries
(function).
define-factorization-eops%
(macro).
define-foreign-aref
(macro).
define-matrix-square-root-scalar-multiplication
(macro).
diagonal-log-sum%
(function).
dimensions-as-matrix
(function).
epsilon
(function).
expand-specifications%
(function).
factor
(generic reader).
float-type
(type).
foreign-size
(function).
fortran-argument
(class).
fortran-argument/new-variable
(function).
fortran-argument/output
(class).
fortran-argument/output-initializer-form
(generic function).
fortran-argument/size
(class).
fortran-argument/type
(class).
fortran-atom
(class).
fortran-character
(class).
fortran-input-array
(class).
fortran-input-output-array
(class).
fortran-output-array
(class).
fortran-work-area
(class).
internal-type
(type).
invert-triangular%
(function).
ipiv-internal
(generic reader).
ipiv-mixin
(class).
lapack-call
(macro).
lapack-call-w/query
(macro).
lapack-info
(class).
lapack-info-wrap-argument
(function).
lapack-work-query-area
(class).
lapack-work-query-size
(class).
last-rows-ss
(function).
least-squares-qr
(function).
lisp-type
(function).
log-with-sign%
(macro).
lu-matrix
(generic reader).
make-cholesky
(function).
make-cholesky%
(function).
make-matrix-square-root
(function).
make-spectral-factorization
(function).
make-svd
(function).
matrix-square-root-left
(reader).
(setf matrix-square-root-left)
(writer).
matrix-square-root-p
(function).
maximum-array-size
(type).
maybe-default-type
(function).
mm-hermitian%
(function).
number-float-type
(function).
output-array-form
(function).
permutations
(generic function).
process-form
(generic function).
process-forms
(function).
query-configuration
(function).
set-feature
(function).
shareable-array?
(function).
spectral-factorization-p
(function).
sum-diagonal%
(function).
svd-p
(function).
tau
(generic reader).
(setf tau)
(generic writer).
transpose-matrix-from-memory
(function).
transpose-matrix-to-memory
(function).
trsm%
(function).
value-from-memory%
(function).
value-to-memory%
(function).
with-array-input
(macro).
with-array-input-output
(macro).
with-array-output
(macro).
with-fortran-atom
(macro).
with-fortran-character
(macro).
with-pinned-array
(macro).
with-work-area
(macro).
wrap-argument
(generic function).
wrap-arguments
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
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.
lla
.
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.
lla
.
Determinant of a matrix. If you need the log of this, use LOGDET directly.
lla
.
Return the eigenvalues of A. See the documentation of SPECTRAL-FACTORIZATION about ABSTOL.
lla
.
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++
—–+ –++
++++++ ++++
Pivot indices, counting from 0, in a format understood by SELECT.
Example:
(let+ (((&accessors-r/o lu-l lu-u ipiv) (lu a)))
(num= (select a ipiv) (mm lu-l lu-u) ipiv-inverse t)) ; => T
lla
.
Inverted permutation for pivot indices, in a format understood by SELECT.
Example:
(let+ (((&accessors-r/o lu-l lu-u ipiv-inverse) (lu a)))
(num= a (select (mm lu-l lu-u) ipiv-inverse t))) ; => T
lla
.
Multiply arguments from left to right using MM.
lla
.
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.
lla
.
Convenience function to create a matrix from a left square root.
lla
.
Cholesky factorization.
Compute the hermitian factorization.
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.
lla
.
diagonal-matrix
) &key tolerance) ¶For pseudoinverse, suppressing diagonal elements below TOLERANCE (if given, otherwise / is just used without any checking.
lower-triangular-matrix
) &key) ¶upper-triangular-matrix
) &key) ¶hermitian-matrix
) &key) ¶hermitian-factorization
) &key) ¶array
) &key) ¶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.
lla
.
Return X such that XX^T=A.
lla
.
diagonal-matrix
)) ¶hermitian-matrix
)) ¶matrix-square-root
)) ¶Logarithm of the determinant of a matrix. Return -1, 1 or 0 (or equivalent) to correct for the sign, as a second value.
LU decomposition of A
Matrix multiplication of A and B.
lla
.
(eql t)
) (b diagonal-matrix
)) ¶diagonal-matrix
) (b (eql t)
)) ¶diagonal-matrix
) (b diagonal-matrix
)) ¶diagonal-matrix
) (b vector
)) ¶vector
) (b diagonal-matrix
)) ¶array
) (b diagonal-matrix
)) ¶diagonal-matrix
) (b array
)) ¶(eql t)
) (b vector
)) ¶vector
) (b (eql t)
)) ¶vector
) (b vector
)) ¶wrapped-matrix
)) ¶wrapped-matrix
) b) ¶wrapped-matrix
) (b wrapped-matrix
)) ¶(eql t)
) (b array
)) ¶array
) (b (eql t)
)) ¶array
) (b array
)) ¶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.
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.
lla
.
matrix-square-root
)) ¶Return X that solves AX=B. When B is a vector, so is X.
lla
.
diagonal-matrix
) b) ¶upper-triangular-matrix
) b) ¶lower-triangular-matrix
) b) ¶hermitian-matrix
) (b array
)) ¶hermitian-factorization
) (b array
)) ¶hermitian-matrix
) b) ¶array
) (b array
)) ¶wrapped-matrix
)) ¶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.
Trace of a square matrix.
spectral-factorization
)) ¶array-operations/generic
.
matrix-square-root
)) ¶array-operations/generic
.
number
) (b matrix-square-root
)) ¶num-utils.elementwise
.
matrix-square-root
) (b number
)) ¶num-utils.elementwise
.
matrix-square-root
)) ¶num-utils.elementwise
.
matrix-square-root
) b) ¶num-utils.elementwise
.
matrix-square-root
) (b number
)) ¶num-utils.elementwise
.
lla-efficiency-warning-array-type
) stream) ¶The LAPACK procedure returned a nonzero info code.
lla
.
error
.
Superclass of all LAPACK errors with a positive INFO
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.
lla
.
warning
.
See *LLA-EFFICIENCY-WARNING-ARRAY-TYPE*.
Internal error in LLA.
Could not classify object as a numeric type handled by LLA.
Cholesky factorization a matrix.
lla
.
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.
lla
.
structure-object
.
as-array
.
e2*
.
e2*
.
e2+
.
e2+
.
e2/
.
left-square-root
.
right-square-root
.
num-utils.interval
.
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.
Singular value decomposition. Singular values are in S, in descending order. U and VT may be NIL in case they are not computed.
Factorization for an indefinite hermitian matrix with pivoting.
lla
.
LU factorization of a matrix with pivoting. (SELECT A IPIV) is (MM L U), when IPIV is used to obtain the permutation.
lla
.
QR factorization of a matrix.
lla
.
invert-xx
.
qr
.
(setf tau)
.
tau
.
matrix storing the QR factorization.
:qr
qr
.
This slot is read-only.
Array which serves as an input. See FORTRAN-INPUT-ARRAY.
lla
.
Input/output array. See FORTRAN-INPUT-OUTPUT-ARRAY.
lla
.
Output array. See FORTRAN-OUTPUT-ARRAY.
lla
.
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.
lla
.
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
lla
.
Shorthand for integer atoms (which are not modified). Useful for combining arguments.
lla
.
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.
lla
.
Allocate a work area of SIZE. When TYPE is not given, the call’s default is used.
lla
.
Work area query, takes the place of TWO fortran arguments.
lla
.
Macro that generates a lambda form that can bed used in EXPAND-SPECIFICATIONS%.
lla
.
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.
lla
.
Define elementwise operations for TYPE, trying to convert into arrays.
lla
.
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.
lla
.
LAPACK call which also takes &work-query arguments (in place of two FORTRAN arguments).
lla
.
Log of (ABS VALUE), increments SIGN-CHANGES when negative, return-from block-name (values nil 0) when zero.
lla
.
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.
lla
.
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.
lla
.
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.
lla
.
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).
lla
.
Make character available in an allocated memory area at POINTER for BODY.
lla
.
Allocate a work area of SIZE and INTERNAL-TYPE, and bind the POINTER to its start during BODY.
lla
.
Return an optimization specification for all functions that copy from foreign memory.
lla
.
Return an optimization specification for all functions that copy to foreign memory.
lla
.
Return the list of pointers for all the arguments.
lla
.
Return a list that can be use in a CFFI call.
lla
.
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.
lla
.
Assert that there is at most one LAPACK-INFO in ARGUMENTS.
lla
.
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.
lla
.
Return a form BLAS/LAPACK calls, conditioning on TYPE-VAR. See BLAS-LAPACK-FUNCTION-NAME for the interpretation of FIXME
lla
.
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).
lla
.
Return the common (internal) float type for the arguments.
lla
.
Copy the memory area of type INTERNAL-TYPE at POINTER to ARRAY.
lla
.
Copy the contents of ARRAY to the memory area of type INTERNAL-TYPE at POINTER.
lla
.
Count the permutations in a pivoting vector.
lla
.
Create an array from contents at POINTER.
lla
.
Create a matrix from transposed contents at POINTER.
lla
.
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.
lla
.
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.
lla
.
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).
lla
.
Return the float epsilon for the given internal float type.
lla
.
Expand specifications using (clause internal-type element-type).
lla
.
If FORM is (&NEW VARIABLE), return VARIABLE, otherwise NIL.
lla
.
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.
lla
.
Generate a wrapper for a LAPACK INFO argument, also checking the result and raising a condition if applicable. Useful for WRAP-ARGUMENT.
lla
.
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.
lla
.
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.
lla
.
Return default type from PARAMETERS when TYPE is NIL.
lla
.
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.
lla
.
Return an (internal) float type for a number.
lla
.
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.
lla
.
Process forms and return a list of argument specifications. A form may correspond to multiple arguments.
lla
.
Return the property for INDICATOR from the configuration variable, with an optional default, which can be a function (called on demand).
lla
.
Ensure that symbol is in *FEATURES* iff SET?. Returns no values.
lla
.
lla
.
Sum diagonal of array, checking that it is square.
lla
.
Transpose the contents of ARRAY to the memory area of type INTERNAL-TYPE at POINTER. VECTORs are also handled.
lla
.
Transpose the contents of ARRAY to the memory area of type INTERNAL-TYPE at POINTER. VECTORs are also handled.
lla
.
Wrapper for BLAS routine xTRSM. Solve AX=B, where A is triangular.
lla
.
Return a (LAMBDA (POINTER INDEX) ...) form that can be used to read an element from an array in memory.
lla
.
Return a (LAMBDA (POINTER INDEX VALUE) ...) form that can be used to write an element to an array in memory.
lla
.
Wrap BODY in arguments. Convenience function used to implement the expansion.
lla
.
lla
.
fortran-argument
)) ¶Pointer passed to FORTRAN.
lla
.
hermitian-factorization
)) ¶see documentation of *SYTRF and *HETRF, storage is
in the half specified by HERMITIAN-ORIENTATION and otherwise
treated as opaque.
When applicable, return a form that is used to initialize the OUTPUT variable. When NIL is returned, no binding is established.
lla
.
fortran-input-output-array
) parameters) ¶fortran-output-array
) parameters) ¶fortran-argument/output
) parameters) ¶lla
.
ipiv-mixin
)) ¶pivot indices in LAPACK’s representation, counting from 1
Return the number of permutations in object (which is usually a matrix factorization, or a pivot index.
lla
.
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.
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).
lla
.
lapack-work-query-size
) (pass (eql lla::call)
) parameters body) ¶lapack-work-query-area
) (pass (eql lla::call)
) parameters body) ¶lapack-work-query-size
) (pass (eql lla::query)
) parameters body) ¶lapack-work-query-area
) (pass (eql lla::query)
) parameters body) ¶lapack-work-query-area
) (pass (eql lla::bindings)
) parameters body) ¶lapack-info
) (pass (eql lla::query)
) parameters body) ¶lapack-info
) (pass (eql lla::call)
) parameters body) ¶fortran-work-area
) (pass (eql lla::main)
) parameters body) ¶fortran-input-output-array
) (pass (eql lla::main)
) parameters body) ¶fortran-output-array
) (pass (eql lla::main)
) parameters body) ¶fortran-input-array
) (pass (eql lla::main)
) parameters body) ¶fortran-atom
) (pass (eql lla::main)
) parameters body) ¶fortran-character
) (pass (eql lla::main)
) parameters body) ¶fortran-argument/output
) (pass (eql lla::bindings)
) parameters body) ¶Superclass of all arguments with pointers.
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.
Number of elements in array mapped to a pointer.
For arguments which may have multiple types, mostly arrays or atoms (implemented as single-cell arrays).
Atoms passed to FORTRAN. Input/output (when OUTPUT is given).
Character passed to FORTRAN. Input only, for specifying triangle orientation, etc.
Arrays which serve as inputs. See WITH-ARRAY-INPUT for the semantics of the arguments.
Input/output array. See WITH-ARRAY-INPUT-OUTPUT for the semantics of the arguments.
lla
.
Output array. See WITH-ARRAY-OUTPUT for the semantics of the arguments.
Mixin class for objects with pivoting.
Information from a LAPACK call. See the LAPACK manual for error codes.
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 |
---|
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 |
---|
Jump to: | B C F H I L M P Q S T |
---|
Jump to: | B C F H I L M P Q S T |
---|