Next: Package FL.FUNCTION, Previous: Package FL.PARALLEL, Up: Reference manual [Contents][Index]
This package provides a Common Lisp version of full matrices with elements being numbers of a given type. Those classes are automatically generated when needed. It provides also part of the BLAS and LAPACK operations for those matrices. The corresponding methods are automatically compiled for the given matrix classes. The interface is very similar to the library Matlisp (Matlisp), which provides a CLOS interface to the Fortran BLAS and LAPACK routines.
Threshold below which a matrix is considered to be zero.
A switch for allowing parallel linear algebra for sparse vectors in special situations.
Maximum number of columns and/or rows to print. NIL: no elements, T: all elements.
Format of matrix element field to be printed. A useful format is "~10,2,2E" for debugging purposes.
Maximum number of columns and/or rows to print. Set this to NIL to print no cells (same as *PRINT-ARRAY* set to NIL). Set this to T to print all cells of the tensor.
Default element type for standard matrices.
General matrix class.
Superclasses: <VECTOR>
Abstract class for sparse matrices.
Superclasses: <MATRIX>
A general sparse tensor class which is implemented as a sparse vector containing full-or sparse tensor entries.
Superclasses: TENSOR
Direct slots:
Abstract class for sparse vectors.
Superclasses: <VECTOR>
Direct slots:
Describes an ordered submatrix of a matrix. Only a restricted set of operations is allowed for these matrices and element access is slow. They are indexed with ordinary integers.
Superclasses: <MATRIX>
Direct slots:
General vector class.
If suggest and require are NIL, returns which of
:row
or :column
is prefered for mat. Otherwise
determine if the order in suggest or require is acceptable without
serious performance hit.
Copies a local block in matlisp format into a <ht-sparse-vector>.
Computes the volume spanned by the columns of mat.
Calculates an average of its arguments which should allow for addition and scaling.
Returns alpha X + Y. Uses AXPY! and COPY.
Y <- alpha*X + Y
Returns a dictionary mapping keys to entries for vec.
All column keys for a matrix.
Returns a projection to the range of the given projections.
Converts a compressed matrix into matlisp format.
Construct a compressed sparse matrix with entries of type.
A compressed sparse matrix. This is an abstract class which is made concrete by mixing it with a store-vector containing the entries.
Superclasses: <MATRIX>
Direct slots:
A compressed sparse pattern. Note: we use int32 vectors
for starts
and indices
, such that they do not have to be
copied for a call to the alien sparse solvers.
Direct slots:
Returns a deep copy of X.
Y <- X
Returns the determinant of the square matrix mat.
This routine computes the determinant using a given LR decomposition.
Returns a diagonal matrix with diagonal entries from vec.
Extracts the diagonal from matrix A as a vector.
Constructs a sparse tensor of rank 2 where values is a vector of diagonal entries. If ncomps is given then the tensor dimension is nxn with each diagonal entry being values.
Formats the contents of matrix in rectangular form.
Syntax:
(docols (key mat) ...)
Syntax:
(dorows (key mat) ...)
Returns the dot product of X and Y.
Returns the dot product between |X| and |Y|.
Usage: (dotensor (entry tensor :depth 1) ...) (dotensor ((index1 ... . entry) tensor :depth 1) ...) (dotensor ((index1 ...) tensor :depth 1) ...)
Returns a double-vec
with the entries in comps.
Uniform double-float
vector.
Loops on indices and entries of a vector, matrix or tensor. Examples:
(dovec (entry vec) ...) (dovec ((entry key1 ...) vec) ...)
Type of the elements of the vector/matrix.
Returns the nxn elementary matrix with 1 at position (i,j). The value is freshly allocated.
Tries to coerce obj into Matlisp format.
List of entries.
Tests if an entry is allowed at this position.
Extends A such that the keys in extend which are not in ignore are mapped to identity.
Extract a subvector or submatrix from a sparse vector/matrix. The test is a function of entry and key.
Extract a vector or array of value blocks from sobj.
Returns the nxn identity matrix. The value is freshly allocated.
Short version of generating an arbitrary-dimensional FD discretization of the Laplace operator.
Fills X with element s.
Fills X with random values (obtained by (random s)).
Loop through column keys.
Calls func on all entries of vec.
Calls func on all entries of the collection object and their corresponding keys.
Calls func on all entries of vec and their
corresponding vector indices. The index used should be unserstood by
vref
.
Loop through entries in column col.
Loop through col-keys in row.
Calls func on all indices/keys of vec.
Loop through row-keys and entries in col.
Loop through col-keys and entries in row.
Loop through row-keys in column col.
Loop through col-keys in row.
Loop through row keys.
Returns a full compressed pattern.
Construct a full tensor with entries of type.
Mixin for full tensors.
Superclasses: TENSOR
Direct slots:
Rewriting of GEMM in terms of GEMM!.
Dispatches on the optional job argument (member :nn :tn :nt :tt) and calls the corresponding generic function, e.g. GEMM-NN!.
General matrix-matrix multiplication: Z <- alpha * X * Y + beta * Z
General matrix-matrix multiplication: Z <- alpha * X * Y' + beta * Z
General matrix-matrix multiplication: Z <- alpha * X' * Y + beta * Z
General matrix-matrix multiplication: Z <- alpha * X' * Y' + beta * Z
Rewriting for GESV in terms of GESV!.
Solves a linear system A X = B for X.
Rewriting for GETRF in terms of GETRF!.
Computes the PA=LU decomposition of A which is
stored again in A. ipiv can be a pre-allocated vector which
the routine fills with the indices for column pivoting, or NIL which
implies that the routine allocates such a vector itself. If ipiv is
:none
, no pivoting is done. Returns A as the first value,
the pivot vector as a second value, and a boolean as the third value
indicating that the decomposition succeeded.
Rewriting for GETRS in terms of GETRS!.
Solves the PA=LU decomposition specified by LU and ipiv for the rhs b. The result is stored in b.
Syntax: (GGEV A B [job])
Purpose: Computes the generalized eigenvalues and left/right eigenvectors of A - s B.
1. (GGEV A B :N) => lambda
Computes the generalized eigenvalues of A - s B.
2. (GGEV A B :V) => lambda, V, W
Computes generalized eigenvalues and eigenvectors of (A - sB).
A*V = B*V*diag(lambda), \ W'*A = diag(lambda)*W'*B
with V and W orthogonal (unitary).
Remark: The symmetric/hermitian counterpart of this routine is
hegv
.
Syntax: (HEGV A B [job])
Purpose: Computes the generalized eigenvalues and left/right eigenvectors of A - s B for Hermitian matrices A and B.
1. (HEGV A B :N) => lambda
Computes the generalized eigenvalues of A - s B.
2. (HEGV A B :V) => lambda, V
Computes generalized eigenvalues and eigenvectors of (A - sB).
A*V = B*V*diag(lambda), \ W'*A = diag(lambda)*W'*B
with V and W orthogonal (unitary).
Remark: The non-symmetric counterpart of this routine is
ggev
.
Calculates a ’normal’ nu for the n-1-dimensional hyperplane determined by the n-1 columns of the nx(n-1)-matrix mat. More precisely, this is a vector nu, such that det(A|nu)=|nu|^2. This construction generalizes the cross product in 3 space dimensions.
Returns T, if the indices are in the nonzero pattern.
Checks if the range of indices of two sparse matrices is disjoint.
Returns a int-vec
with the entries in comps.
Uniform int
vector.
Joins matrices either horizontally or vertically depending on
orientation. Due to the call to zeros
this is not yet a
generic function.
Joins matrices horizontally into result.
Compute an instance for storing the join of orientation applied to matrix and matrices.
Joins matrices vertically into result.
Returns NIL, if svec cannot extend automatically when being accessed. Otherwise returns a function mapping keys to vector block sizes.
Returns a list of all keys of dic.
All row keys in the given column for a matrix.
All column keys in the given row for a matrix.
The Kronecker product of matrices A and B.
Returns the 2-norm of x.
Generates the matrix for a dim-dimensional Laplace problem discretized with the 2*dim+1-point stencil on a structured mesh with Dirichlet boundary conditions.
Generates a sparse matrix for a 1-dimensional Laplace problem discretized with the 3-point stencil on a structured mesh.
Returns the maximum norm of x.
Returns the p-norm of x.
Multiply X by Y.
Multiply X by Y^t.
Allocates an instance for the product of X and Y.
Multiply X^t by Y.
Allocates an instance for the product of X^t and Y.
Returns X + Y.
Y <- X + Y
Returns X-Y. Uses AXPY.
Y - X -> Y. Uses AXPY!.
Adds increment to result which should be a symbol. If its value is nil then result is set to increment.
Returns X .* Y. Uses M.*! and COPY.
Returns the inverse of X. Needs the identity matrix given by
eye
which makes this function not generally applicable.
Returns a double-vec
of length dim and initial value
init.
Generates a standard matrix as specified by its arguments. If two arguments are provided, they should be numbers which are interpreted as rows and columns. If only one argument is provided, it should be either a number meaning the rows and columns of a square matrix or a nested list or vector structure defining the contents matrix.
Generates a real matrix as specified by its arguments.
Generates an instance of a tensor with DOUBLE-FLOAT entries and the given dimensions.
Generates a real matrix of dimension dim x 1.
Prints a list of differences between X and Y.
Low-level block lookup for a sparse block matrix.
Returns a dictionary mapping row-key to entry.
Returns a dictionary mapping col-key to entry.
Extract a submatrix of size nrows times ncols out of x starting from position from-row/from-col.
Returns a zero matrix for storing the transpose of X.
Returns T if X and Y have equal entries, otherwise NIL.
Extract matrix X out of matrix Y from the position given by ROW-OFFSET and COL-OFFSET.
Returns T, if mat is the identity, i.e. if the elementwise difference to the identity is not larger than threshold.
Inject matrix X in matrix Y at the position given by ROW-OFFSET and COL-OFFSET.
Returns a random nxn or (if m is provided) nxm matrix. The value is freshly allocated.
Returns the matrix element A[i,j]
.
Returns T, iff mat is square.
Returns T, if mat is symmetric up to a accuracy in THRESHOLD. If output is T, the differences to symmetry are reported.
We allow multiple vectors, for solving linear problems in parallel.
Returns T if each entry of x is smaller or equal than threshold.
Number of matrix columns.
Returns the p-norm of x.
Scales x to have p-norm equal to 1.
Scales x destructively to have p-norm equal to 1.
Total number of (block) entries for vectors.
Number of matrix rows.
Returns a function converting a number to a number of the given number-type or recursively also a vector of numbers.
Number of nonzero entries of a sparse matrix pattern.
Returns nxn or (if m is provided) nxm ones. The value is freshly allocated.
Checks if index range and index domain of some matrix are disjoint.
Rank of a tensor.
Read a compressed matrix of type orientation from the given list of triplets of the form (i j Aij). If identify-p is T, try to identify entries which are equal.
Removes a column of smat.
Remove the entry for key from the sparse object.
Removes a row of smat.
All row keys for a matrix.
Set the row of matrix A defined by KEY to identity
Returns alpha * X. Uses SCAL! and COPY.
X <- alpha X
Type of the scalars for the vector class.
Copies a local block in matlisp format into a <sparse-vector>.
Can be used for obtaining a diagonal modification to get ILU_mod.
Shifts the index range of a sparse tensor or a vector. Offsets can either be a number in which case all indices are shifted by this number or a list of the length of the tensor rank which specifies the shift for each dimension.
Shows the contents of matrix in a readable form.
Slices tensor. fixed determines which indices are fixed.
Sparse LDU decomposition
Sparse matrix-matrix or matrix-vector multiplication. Usually, m* should be used. But in situations, where A or B are very sparse, the complexity of this routine is much lower.
Converts the sparse matrix A to CCS format. row-keys and col-keys may denote a submatrix, col-ranges and row-ranges may be used for extracting even subblocks of the entries.
This is a rather complicated routine which has not yet been parallelized. Theoretically, this might be a bottleneck for some applications, but, practically, an appropriate case has not yet appeared.
Converts sparse matrices into matlisp format.
Constructor for sparse-tensor
.
Transforms all or a part of svec corresponding to the keys in keys and maybe the ranges in ’ranges’ to a matlisp matrix.
Defines the programmatic class standard-matrix
for element type
type as extensions of the programmatic class store-vector
.
Mixin for dense matrices.
Superclasses: <MATRIX>
Direct slots:
Tests if obj is a standard-matrix
.
This mixin yields vector behaviour for a class
containing a store. The store is a unifom array with elements of a certain
type which can be determined by the funtion element-type
. It
often is but does not have to be equal to the type of scalars for this
vector which can be obtained by calling the function
scalar-type
.
Superclasses: <VECTOR>
Direct slots:
General extraction of submatrices specified by non-adjacent lists of row- and column indices.
Contracts TENSOR1 and TENSOR2 along the pairs of indices specified by CONTRACTION-PAIRS.
Tensor superclass.
Applies func to each index of tensor up to depth. job can be :entry, :index, or :both.
Maps tensor with func to a tensor of the same type.
Reader for a tensor entry.
Total number of entries for block vectors.
Total number of rows for a matrix (works also for block matrices).
Transpose the matrix x.
Sets Y to the transpose of X.
Transpose a sparse matrix pattern.
Returns a uint-vec
with the entries in comps.
Uniform uint
vector.
Returns a freshly created copy of the i-th carthesian unit vector in dimension dim.
Low-level key lookup. Returns NIL if there is no block at this position.
Flexible uniform vector type definition.
Extract a subvector of size size out of x starting from position offset.
Length of vector.
Reader for x_i.
X <- 0 X. Uses SCAL!.
Returns nxn or (if m is provided) nxm zeros. The value is freshly allocated.
Next: Package FL.FUNCTION, Previous: Package FL.PARALLEL, Up: Reference manual [Contents][Index]