VARS
*
*eps*
+

>Matrix
>Vector
abs
abs!
acos
acos!
arbitrary
arbitrary?
asvec
asin
asin!
atan
atan!
block
blockfn
cbrt
cbrt!
ceil
ceil!
cholesky
clatrix
clatrix?
cols
column
column?
complexpower
constant
constructclatrix
cos
cos!
cosh
cosh!
dense
det
diag
div
dot
dotom
eigen
epszero?
ereduce
exp
exp!
eye
floor
floor!
fromindices
fromsparse
get
hstack
i
intarraytise
iswild
log
log!
log10
log10!
lu
makeconstr
makenewmatrix
map
map!
mapindexed
matrix
matrix?
maybepositive
maybesymmetric
me
mget
mset!
mult
nperms
ncols
norm
normalize
nrows
ones
permute
permutecols
permuterows
positive
positive?
pow
promotecfun*
promotemffun*
promotemfun*
qr
rand
randn*
rank
reshape
reshape!
rnorm
rowlist
row?
rows
rreflection
rspectral
seed
set
signum
signum!
sin
sin!
sinh
sinh!
size
slice
slicecolumn
slicerow
slicer
slices
solve
sqrt
sqrt!
square?
sum
svd
symmetric
symmetric?
t
tan
tan!
tanh
tanh!
tomatrix
tovecs
trace
uniquifier
unseed
updatehashwithconstr
vec?
vector
vectormatrix?
vstack
withseed
zeros
*
*eps*
+

>Matrix
>Vector
abs
abs!
acos
acos!
arbitrary
arbitrary?
asvec
asin
asin!
atan
atan!
block
blockfn
cbrt
cbrt!
ceil
ceil!
cholesky
clatrix
clatrix?
cols
column
column?
complexpower
constant
constructclatrix
cos
cos!
cosh
cosh!
dense
det
diag
div
dot
dotom
eigen
epszero?
ereduce
exp
exp!
eye
floor
floor!
fromindices
fromsparse
get
hstack
i
intarraytise
iswild
log
log!
log10
log10!
lu
makeconstr
makenewmatrix
map
map!
mapindexed
matrix
matrix?
maybepositive
maybesymmetric
me
mget
mset!
mult
nperms
ncols
norm
normalize
nrows
ones
permute
permutecols
permuterows
positive
positive?
pow
promotecfun*
promotemffun*
promotemfun*
qr
rand
randn*
rank
reshape
reshape!
rnorm
rowlist
row?
rows
rreflection
rspectral
seed
set
signum
signum!
sin
sin!
sinh
sinh!
size
slice
slicecolumn
slicerow
slicer
slices
solve
sqrt
sqrt!
square?
sum
svd
symmetric
symmetric?
t
tan
tan!
tanh
tanh!
tomatrix
tovecs
trace
uniquifier
unseed
updatehashwithconstr
vec?
vector
vectormatrix?
vstack
withseed
zeros
« Index of all namespaces of this project
(* a b)
(* a b & as)
* computes the product of vectors and matrices (and scalars as scaling factors). All matrices must have compatible sizes.
Dynamic
Threshold value for defining zero. If absolute value of a number less or equals to *eps* then it's considered zero.
(+)
(+ a)
(+ a b)
(+ a b & as)
+ sums vectors and matrices (and scalars as if they were constant matrices). All the matrices must have the same size.
( a)
( a b)
( a b & as)
 differences vectors and matrices (and scalars as if they were constant matrices). All the matrices must have the same size.
(asvec m)
asvec converts a matrix object into a seqofseqs of its elements in rowmajor order. Treats vector? type matrices differently, though, flattening the return seq to a single vector.
macro
(block blockspec)
block creates a block matrix using normal block matrix syntax written as a rowmajor ordered vector of vectors. Each entry in the specification can be a Matrix, a number, or a null symbol (either . or _). Numbers are translated as constant matrices of the appropriate size to complete the block matrix. Null symbols are considered as constant 0 matrices and are also automatically constrained to be the proper size. Any integers which do not share a row or a column with a larger matrix are assumed to be 1x1 sized.
(blockfn matrices)
blockfn is the main worker subfunction for block. It's public so that block can macroexpand to call it. It creates a block matrix. Any number n represents the alln matrix of an appropriate size to make the matrix.
(cholesky mat)
`(cholesky A)` is the Cholesky square root of a matrix, U such that `U' U = A`. Note that A must be positive (semi) definite for this to exist, but cholesky requires strict positivity.
(cols mat)
(cols m idxs)
cols explodes a Matrix into its constituent columns in the style of rows. See rows documentation for more detail.
Private
(complexpower z e)
complexpower computes z^e for some complex number z and double exponent e.
(constant n c)
(constant n m c)
constant creates a column or matrix with every element equal to the same constant value.
(diag seqormatrix)
diag creates a diagonal matrix from a seq of numbers or extracts the diagonal of a Matrix as a seq.
(dot m1 m2)
dot computes the inner product between two vectors. This is extended to work on matrices considered as nmdimensional vectors.
(eigen A)
(eigen A B)
eigen computes the eigensystem (or generalized eigensystem) for a square Matrix A. Type hinting on A uses optimized routines for symmetric matrices while `(eigen A B)` will check to ensure A and B are symmetric before computing the generalized eigenvectors x such that `A x = L B x`. In nonsymmetric computations, eigenvalues and vectors may be complex! In all cases, the real parts are returned as keys :values and :vectors in the output hash map, but if imaginary parts exist they are stored in :ivalues and :ivectors. Inproper symmetry hinting or failure to check for imaginary values will lead to mistakes in using the matrix spectrum.
(fromindices n m fun)
fromindices builds an n`x`m matrix from a function mapping the indices to values which are then stored at that location.
(fromsparse n m specs)
(fromsparse n specs)
fromsparse creates a new Matrix from a sparse representation. A sparse representation is a seq of seqs, each inner seq having the form `[i j v]` stating that in the final matrix A, `(get A i j)` is v. The sparse specifications are applied in order, so if they overlap the latter spec will override the prior ones.
(get m i)
(get m r c)
Given matrix m, get row r and column c, where r and/or c can be either a value or vector to return a single value or a submatrix. Pass in a single arg, i, so do rowfirst traversal index access.
(hstack & vecseq)
hstack concatenates a number of matrices by aligning them horizontally. Each matrix must have the same number of rows. Optionally, the any entry may be a seq, which is spliced into the arguments list via flatten, somewhat like the final argument to apply.
(i mat)
i computes the inverse of a matrix. This is done via Gaussian elmination through the solve function. It can be numerically very unstable if the matrix is nearly singular.
Private
(iswild sym)
iswild is a helper function that defines what a wildcard symbol is, used in block, slice, and slices.
(lu mat)
`(lu A)` computes the LU decomposition of A, returning `{:p P :l L :u U}` such that `A = PLU`.
Private
(makeconstr e)
makeconstr is a subfunction for block. Generates the sizeconstraint map based on the elements of the seqs in a block matrix specification.
(map fun mat)
(map fun mat arg)
(map fun mat arg & more)
map is a specialization of mapindexed where the function does not get passed the indices.
(mapindexed fun mat)
mapindexed maps a function over the indices and corresponding elements to create a new equivalently sized matrix with the resulting elements.
multimethod
matrix creates a Matrix from a seq of seqs, specifying the matrix in rowmajor order. The length of each seq must be identical or an error is throw.
(maybepositive m)
maybepositive attempts to assert that a matrix is positive definite, but only succeeds if it actually is. (Checked via eigenvalue positivity.)
(maybesymmetric m)
maybesymmetric attempts to assert that a matrix is symmetric, but only succeeds if it actually is.
(normalize mat & [flags])
normalize normalizes a matrix as a single column or collection of column vectors.
(permute mat & {:keys [r c rowspec colspec]})
permute permutes the rows and the columns of a matrix. :rowspec and :colspec (or, for short, :r and :c) are keyword arguments providing seqs listing the indices of the permutation.
(positive m)
positive asserts that a matrix is positive definite. By definition, it is also symmetric.
(pow A e)
`(pow A e)` computes the eth matrix power of the square matrix A using Eigendecomposition. e need not be an integer.
(rnorm mu sigma n m)
(rnorm mu sigma n)
(rnorm n m)
(rnorm n)
`(rnorm mu sigma n m)` is an n`x`m Matrix with normally distributed random elements with mean mu and standard deviation sigma.
(rows mat)
(rows m idxs)
rows explodes a Matrix into its constituent rows. By default, all the rows are returned in normal order, but particular indices can be specified by the second argument.
(rspectral norspectrum)
rspectral creates a random matrix with a particular spectrum, or, if only an integer n is passed, then it creates a random n`x`n positive definite matrix with a random spectrum. The orthogonal matrices are generated by using 2n composed Householder reflections.
(seed n)
You can set the seed used to generate the values in a random matrix if you need repeatablity for some reason.
(size m)
Returns the size of a Clatrix matrix or vector, as a vector of dimension sizes i.e. [rows, cols] for a Matrix and [rows] for a Vector.
macro
(slice matrix rowspec colspec & values?)
slice is the primary function for accessing and modifying a matrix at the single row, column, entry, or full matrix level. The row/colspec variables are either an integer or the atom '_ signifying that the index should run over all possible values for the row or column index. If a fourth argument is passed it is assumed to be a sizeconforming entry, row, or matrix to be inserted into the spec'd location.
macro
(slices matrix rowspec colspec & values?)
slices provides an identical interface to slice except that it returns a seq (or seqofseqs) instead of a Matrix.
(solve A B)
solve solves the equation `Ax = B` for the column Matrix x. Positivity and symmetry hints on A will cause solve to use optimized LAPACK routines.
(svd A & {:keys [type], :or {type :sparse}})
`(svd A)` computes the sparse singular value decomposition of A returning a map with keys `{:values L :left U :right V}` such that `A = U (diag L) V`. If `(size A)` is `[n m]` and k is (size L), we have the size of U as `[n k]`, `(diag L)` as `[k k]`, and `(t V)` as `[k m]`. Rank is calculated as number of nonzero values in L. *eps* constant is used to check if value is zero. Optional key: :type  :full for the full SVD :value for SVD values only
(tovecs m)
tovecs converts a matrix object into a seqofseqs of its elements in rowmajor order. Unlike asvec, does not flatten 1*n or n*1 matrices into a single vector.
(unseed)
When you are done changing the seed, you can go back to a pseudorandom seed. Uses the same algorithm as java's default Random constructor.
Private
(updatehashwithconstr hsh constr i j key)
updatehashwithconst is a subfunction for block. It examines a particular constraint against an old hash representation of the full set of constraints, hsh. Updates the hash at position [i j] to respect the current constraint constr according to key
(vstack & vecseq)
vstack is vertical concatenation in the style of hstack. See hstack documentation for more detail.