clojure.math.internal.ejml documentation

Internal interface to EJML library functions and types.

add

(add a b)
Adds matrix B to matrix A.

det

(det m)
Computes determinant of the matrix.

diag

(diag v)
Constructs a diagonal matrix from a vector.

eig

(eig m)
Computes eigen-value decomposition of a real matrix m.
Returns a sequence of maps with keys :eigenvalue and :eigenvector.

element-div

(element-div m1 m2)
Computes element-by-element division.

element-mult

(element-mult m1 m2)
Computes element-by-element multiplication.

from-matrix

(from-matrix m)
Converts an EJML Matrix64F to a Clojure vector or vectors.

make-matrix

(make-matrix num-rows num-cols)
Creates a new EJML Matrix64F.

matrix?

(matrix? m)
Returns true if M is not a one-dimensional row (column) vector.

max-element

(max-element m)
Returns an element with the maximum value.

min-element

(min-element m)
Returns an element with the minimum value.

mult

(mult a b)
Computes matrix to matrix product.

P = A * B

P_{ij} = \sum_{k=1:n} A_{ik} B_{kj}

mult-inner

(mult-inner m)
Computes the matrix multiplication inner product

P = M' * M

P_{ij} = \sum_{k=1:n} M_{ki} M_{kj}

mult-outer

(mult-outer m)
Computes the matrix multiplication outer product

P = M * M'

P_{ij} = \sum_{k=1:m} M_{ik} M_{jk}

norm

(norm m)(norm m ord)
Computes matrix or vector norm.

The following norms can be calculated (similar to NumPy):

====  =============================  ==========================
ord   norm for matrices              norm for vectors
====  =============================  ==========================
0     --                             number of non-zero values
1     max column-sum of abs. values  sum of absolute values
2     2-norm (largest sing. value)   Euclidean norm (default)
:inf  max row-sum of abs. values     max of absolute values
:fro  Frobenius norm (default)       --

pinv

(pinv m)
Computes the Moore-Penrose pseudo-inverse of M: M^{+} = (M' M)^{-1} M'.

scalar-mult

(scalar-mult a alpha)
Multiplies matrix A by a scalar alpha.

sub

(sub a b)
Subtracts matrix B from matrix A.

sum-elements

(sum-elements m)
Computes a sum of all elements.

svd

(svd m & {:keys [compact compute-uv order], :or {compact true, compute-uv true, order true}})
Computes singular value decomposition of matrix M as M = U * S * V',
where U and V are orthogonal, and S is diagonal. Returns a map with
keys :u, :s (a vector of singular values), and :v. May return nil
if decomposition fails.

Keyword arguments:

:compact     If false and M is m x n, the matrices U and V' are square m
             x m and n x n respectively.  If true and M is m x n,
             svd calculates only the first k columns of U, and the
             first k rows of V', where k = min(m, n).
             (default: false)

:compute-uv  If false, svd calculates only a vector of singular
             values :s. If true, svd calculates U and V in
             addition to S. (default: true)

:order       If false, singular values are not ordered.
             If true, singular values are given in decreasing order.
             (default: true)

to-matrix

(to-matrix seq-of-seqs)
Converts a sequences of sequences to a new EJML Matrix64F.

trans

(trans m)
Transposes matrix.