Liking cljdoc? Tell your friends :D

provisdom.math.matrix


assoc-columnclj

(assoc-column m column numbers)

Sets a column in a matrix using the specified numbers.

Sets a column in a matrix using the specified numbers.
sourceraw docstring

assoc-diagonalclj

(assoc-diagonal m numbers)

Sets a diagonal in a matrix using the specified numbers.

Sets a diagonal in a matrix using the specified numbers.
sourceraw docstring

assoc-rowclj

(assoc-row m row numbers)

Sets a row in a matrix using the specified numbers.

Sets a row in a matrix using the specified numbers.
sourceraw docstring

column-matrixclj

(column-matrix numbers)
(column-matrix size row->number)

Returns a column matrix created from numbers or from size and row->number. size is the size of the returned matrix. Function row->number takes a row and returns a number.

Returns a column matrix created from `numbers` or from `size` and
`row->number`. `size` is the size of the returned matrix. Function
`row->number` takes a row and returns a number.
sourceraw docstring

column-matrix?clj

(column-matrix? x)

Returns true if a column-matrix (i.e., matrix with exactly one column).

Returns true if a column-matrix (i.e., matrix with exactly one column).
sourceraw docstring

columnsclj

(columns m)

Returns the number of columns.

Returns the number of columns.
sourceraw docstring

compute-matrixclj

(compute-matrix rows columns row+column->number)

Function row+column->number takes a row and column and returns a number.

Function `row+column->number` takes a `row` and `column` and returns a
number.
sourceraw docstring

concat-columnsclj

(concat-columns)
(concat-columns m & ms)

Appends columns from all the matrices after the first to the first. Each matrix's row count must be the same or will return nil.

Appends columns from all the matrices after the first to the first. Each
matrix's row count must be the same or will return nil.
sourceraw docstring

concat-rowsclj

(concat-rows)
(concat-rows m & ms)

Appends rows from all the matrices after the first to the first. Each matrix's column count must be the same or will return nil.

Appends rows from all the matrices after the first to the first. Each
matrix's column count must be the same or will return nil.
sourceraw docstring

constant-matrixclj

(constant-matrix rows columns)
(constant-matrix rows columns number)

Constructs a new matrix of value's (or zeros (doubles)) with the given rows and columns.

Constructs a new matrix of `value`'s (or zeros (doubles)) with the given
`rows` and `columns`.
sourceraw docstring

deserialize-lower-triangular-matrixclj

(deserialize-lower-triangular-matrix numbers)
(deserialize-lower-triangular-matrix numbers
                                     {:provisdom.math.matrix/keys [by-row?]
                                      :or {by-row? true}})
(deserialize-lower-triangular-matrix diagonal-numbers
                                     off-diagonal-numbers
                                     {:provisdom.math.matrix/keys [by-row?]
                                      :or {by-row? true}})

Returns a (square) lower triangular matrix (a matrix with all elements above the diagonal being 0.0). numbers are the elements that will be used to create the lower triangular matrix. off-diagonal-numbers can be used to create the off-diagonal elements, and then any existing diagonal-numbers will fill the diagonal elements. The elements are placed by-row? (default is true).

Returns a (square) lower triangular matrix (a matrix with all elements above
the diagonal being 0.0). `numbers` are the elements that will be used to
create the lower triangular matrix. `off-diagonal-numbers` can be used to
create the off-diagonal elements, and then any existing `diagonal-numbers`
will fill the diagonal elements. The elements are placed `by-row?` (default is
true).
sourceraw docstring

deserialize-symmetric-matrixclj

(deserialize-symmetric-matrix numbers)

Returns a symmetric matrix (a matrix with elements at r,c equal to elements at c,r). numbers are the same as the elements used to create a triangular matrix.

Returns a symmetric matrix (a matrix with elements at r,c equal to elements
at c,r). `numbers` are the same as the elements used to create a triangular
matrix.
sourceraw docstring

deserialize-upper-triangular-matrixclj

(deserialize-upper-triangular-matrix numbers)
(deserialize-upper-triangular-matrix numbers
                                     {:provisdom.math.matrix/keys [by-row?]
                                      :or {by-row? true}})
(deserialize-upper-triangular-matrix diagonal-numbers
                                     off-diagonal-numbers
                                     {:provisdom.math.matrix/keys [by-row?]
                                      :or {by-row? true}})

Returns a (square) upper triangular matrix (a matrix with all elements below the diagonal being 0.0). numbers are the elements that will be used to create the upper triangular matrix. off-diagonal-numbers can be used to create the off-diagonal elements, and then any existing diagonal-numbers will fill the diagonal elements. The elements are placed by-row? (default is true).

Returns a (square) upper triangular matrix (a matrix with all elements below
the diagonal being 0.0). `numbers` are the elements that will be used to
create the upper triangular matrix. `off-diagonal-numbers` can be used to
create the off-diagonal elements, and then any existing `diagonal-numbers`
will fill the diagonal elements. The elements are placed `by-row?` (default
is true).
sourceraw docstring

diagonalclj

(diagonal m)
(diagonal m k)

Returns the specified diagonal of a matrix as a vector. If k>0, returns a diagonal above the main diagonal. If k<0, returns a diagonal below the main diagonal. Works on both square and rectangular matrices.

Returns the specified diagonal of a matrix as a vector. If `k`>0, returns a
diagonal above the main diagonal. If `k`<0, returns a diagonal below the main
diagonal. Works on both square and rectangular matrices.
sourceraw docstring

diagonal-constant-matrixclj

See [[toeplitz-matrix]]
sourceraw docstring

diagonal-matrixclj

(diagonal-matrix diagonal-numbers)
(diagonal-matrix size index->number)
(diagonal-matrix rows columns index->number)

Returns a diagonal matrix (a matrix with all elements not on the diagonal being 0.0). The values on the diagonal can be given by the vector diagonal-numbers. size is the size of the matrix given by a single number. f is a function that takes index and returns a number. Can also return a rectangular diagonal matrix using rows and columns.

Returns a diagonal matrix (a matrix with all elements not on the diagonal
being 0.0). The values on the diagonal can be given by the vector
`diagonal-numbers`. `size` is the size of the matrix given by a single number.
`f` is a function that takes `index` and returns a number. Can also return a
rectangular diagonal matrix using `rows` and `columns`.
sourceraw docstring

diagonal-matrix?clj

(diagonal-matrix? x)

Returns true if a diagonal matrix (the entries outside the main diagonal are all zero).

Returns true if a diagonal matrix (the entries outside the main diagonal are
all zero).
sourceraw docstring

ecount-of-symmetric-or-triangular-matrixclj

(ecount-of-symmetric-or-triangular-matrix size)

Returns the element count (ecount) for a symmetric or triangular matrix. This is the number of elements on the diagonal plus the number of elements above or below the diagonal.

Returns the element count (`ecount`) for a symmetric or triangular matrix.
This is the number of elements on the diagonal plus the number of elements
above or below the diagonal.
sourceraw docstring

ecount-of-symmetric-or-triangular-matrix-without-diagonalclj

(ecount-of-symmetric-or-triangular-matrix-without-diagonal size)

Returns the element count (ecount) for a symmetric or triangular matrix without the diagonal. This is the number of elements above or below the diagonal.

Returns the element count (`ecount`) for a symmetric or triangular matrix
without the diagonal. This is the number of elements above or below the
diagonal.
sourceraw docstring

empty-matrix?clj

(empty-matrix? x)

Returns true if the matrix is an empty matrix.

Returns true if the matrix is an empty matrix.
sourceraw docstring

ereduce-kvclj

(ereduce-kv f init m)
(ereduce-kv f init m1 m2)
(ereduce-kv f init m1 m2 m3)

Function f takes a result, row, column, and number(s). Reduces over 1, 2, or 3 matrices. Number of columns in the first matrix must be the least.

Function `f` takes a result, row, column, and number(s). Reduces over 1, 2,
or 3 matrices. Number of columns in the first matrix must be the least.
sourceraw docstring

filter-by-columnclj

(filter-by-column column-v->bool m)

Returns a matrix. Function 'column-v->bool' takes a column-vector.

Returns a matrix. Function 'column-v->bool' takes a column-vector.
sourceraw docstring

filter-by-rowclj

(filter-by-row row-v->bool m)

Returns a matrix. Function 'row-v->bool' takes a row-vector.

Returns a matrix. Function 'row-v->bool' takes a row-vector.
sourceraw docstring

filter-symmetric-matrixclj

(filter-symmetric-matrix v->bool symmetric-m)

Takes and returns a symmetric matrix. 'v->bool' takes a row-vector or column-vector.

Takes and returns a symmetric matrix. 'v->bool' takes a row-vector or
column-vector.
sourceraw docstring

get-columnclj

(get-column m column)

Gets a column of a matrix, as a vector.

Gets a `column` of a matrix, as a vector.
sourceraw docstring

get-rowclj

(get-row m row)

Gets a row of a matrix, as a vector.

Gets a `row` of a matrix, as a vector.
sourceraw docstring

get-slices-as-matrixclj

(get-slices-as-matrix m
                      {:provisdom.math.matrix/keys [row-indices column-indices
                                                    exception-row-indices
                                                    exception-column-indices]})

Performs a slice on the matrix given by the options. Options: ::row-indices returns all rows by default, can pass a row index or sequence of row indices ::column-indices returns all columns by default, can pass a column index or sequence of column indices ::exception-row-indices can pass a row index or sequence of row indices to exclude ::exception-column-indices can pass a column index or sequence of column indices to exclude. Exceptions override inclusions. Can be used to permute matrix through index sequence ordering.

Performs a slice on the matrix given by the options.
Options:
  `::row-indices` returns all rows by default, can pass a row index or
    sequence of row indices
  `::column-indices` returns all columns by default, can pass a column index
    or sequence of column indices
  `::exception-row-indices` can pass a row index or sequence of row indices
    to exclude
  `::exception-column-indices` can pass a column index or sequence of column
    indices to exclude.
  Exceptions override inclusions. Can be used to permute matrix through index
  sequence ordering.
sourceraw docstring

identity-matrixclj

(identity-matrix size)

Constructs an identity matrix with the given size.

Constructs an identity matrix with the given `size`.
sourceraw docstring

insert-columnclj

(insert-column m column numbers)

Inserts a column of numbers in a matrix at the specified column.

Inserts a column of `numbers` in a matrix at the specified `column`.
sourceraw docstring

insert-rowclj

(insert-row m row numbers)

Inserts a row of numbers in a matrix at the specified row.

Inserts a row of `numbers` in a matrix at the specified `row`.
sourceraw docstring

kronecker-productclj

(kronecker-product)
(kronecker-product m)
(kronecker-product m1 m2)
(kronecker-product m1 m2 & ms)

Generalization of the outer product.

Generalization of the outer product.
sourceraw docstring

lower-triangular-matrix?clj

(lower-triangular-matrix? x)

Returns true if a lower triangular matrix (the entries above the main diagonal are all zero).

Returns true if a lower triangular matrix (the entries above the main
diagonal are all zero).
sourceraw docstring

matrix->sparseclj

(matrix->sparse m)
(matrix->sparse m number->bool)

Returns a sparse-matrix (i.e., a vector of tuples of [row column number]). Function number->bool takes a number.

Returns a sparse-matrix (i.e., a vector of tuples of [row column number]).
Function `number->bool` takes a number.
sourceraw docstring

matrix-finite-non-?clj

(matrix-finite-non-? x)

Returns true if a matrix of finite non-negative numbers.

Returns true if a matrix of finite non-negative numbers.
sourceraw docstring

matrix-finite?clj

(matrix-finite? x)

Returns true if a matrix of finite numbers.

Returns true if a matrix of finite numbers.
sourceraw docstring

matrix-num?clj

(matrix-num? x)

Returns true if a matrix of num (numbers without NaN).

Returns true if a matrix of num (numbers without NaN).
sourceraw docstring

matrix-partitionclj

(matrix-partition m first-bottom-row first-right-column)

Returns a map containing the four sub-matrices labeled ::top-left, ::bottom-left, ::top-right, and ::bottom-right. Matrices can be merged back together using merge-matrices. first-bottom-row is the bottom of where the slice will occur. first-right-column is the right edge of where the slice will occur.

Returns a map containing the four sub-matrices labeled `::top-left`,
`::bottom-left`, `::top-right`, and `::bottom-right`. Matrices can be merged
back together using [[merge-matrices]]. `first-bottom-row` is the bottom of
where the slice will occur. `first-right-column` is the right edge of where
the slice will occur.
sourceraw docstring

matrix-prob?clj

(matrix-prob? x)

Returns true if a matrix of probabilities.

Returns true if a matrix of probabilities.
sourceraw docstring

matrix?clj

(matrix? x)

Returns true if a matrix (i.e., dimensionality is 2, contains numbers only, rows have equal positive lengths unless the empty matrix.)

Returns true if a matrix (i.e., dimensionality is 2, contains numbers only,
rows have equal positive lengths unless the empty matrix.)
sourceraw docstring

mdlclj

source

merge-matricesclj

(merge-matrices {:provisdom.math.matrix/keys [top-left bottom-left top-right
                                              bottom-right]})

Returns a Matrix created by binding four matrices together. Matrices can be partitioned into four matrices using matrix-partition. Takes a map containing keys: ::top-left ::bottom-left ::top-right ::bottom-right.

Returns a Matrix created by binding four matrices together. Matrices can be
partitioned into four matrices using [[matrix-partition]]. Takes a map
containing keys:
  `::top-left`
  `::bottom-left`
  `::top-right`
  `::bottom-right`.
sourceraw docstring

mx*clj

(mx* m)
(mx* m1 m2)
(mx* m1 m2 & ms)

Matrix multiplication. Number of columns of the first matrix must match the number of rows of the second matrix. Use [tensor/multiply] for more general multiplication.

Matrix multiplication. Number of columns of the first matrix must match the
number of rows of the second matrix. Use [tensor/multiply] for more general
multiplication.
sourceraw docstring

outer-productclj

(outer-product v)

An outer product is the tensor product of two coordinate vectors, a special case of the Kronecker product of matrices. The outer product of two coordinate vectors is a matrix such that the coordinates satisfy w_ij = u_i × u_j.

An outer product is the tensor product of two coordinate vectors, a special
case of the Kronecker product of matrices. The outer product of two coordinate
vectors is a matrix such that the coordinates satisfy w_ij = u_i × u_j.
sourceraw docstring

remove-columnclj

(remove-column m column)

Removes a column in a matrix

Removes a column in a matrix
sourceraw docstring

remove-rowclj

(remove-row m row)

Removes a row in a matrix

Removes a row in a matrix
sourceraw docstring

replace-submatrixclj

(replace-submatrix m submatrix row-start column-start)

Returns a Matrix after substituting a submatrix at top-left location row-start and column-start. row-start and column-start can be negative. Unassigned elements will be 0.0.

Returns a Matrix after substituting a `submatrix` at top-left location
`row-start` and `column-start`. `row-start` and `column-start` can be
negative. Unassigned elements will be 0.0.
sourceraw docstring

rnd-matrix!clj

(rnd-matrix! rows columns)

Returns matrix with random elements.

Returns matrix with random elements.
sourceraw docstring

rnd-reflection-matrix!clj

(rnd-reflection-matrix! size)

Returns a random Householder reflection matrix of size.

Returns a random Householder reflection matrix of `size`.
sourceraw docstring

rnd-spectral-matrix!clj

(rnd-spectral-matrix! spectrum-vector)

Returns a random matrix with a particular spectrum-vector. The orthogonal matrices are generated by using 2 × size of spectrum-vector composed Householder reflections.

Returns a random matrix with a particular `spectrum-vector`. The orthogonal
matrices are generated by using 2 × size of `spectrum-vector` composed
Householder reflections.
sourceraw docstring

round-roughly-zero-columnsclj

(round-roughly-zero-columns m accu)

Returns a matrix after rounding any roughly-zero columns.

Returns a matrix after rounding any roughly-zero columns.
sourceraw docstring

round-roughly-zero-rowsclj

(round-roughly-zero-rows m accu)

Returns a matrix after rounding any roughly-zero rows.

Returns a matrix after rounding any roughly-zero rows.
sourceraw docstring

row-matrixclj

(row-matrix numbers)
(row-matrix size column->number)

Returns a row matrix created from numbers or from size and column->number. size is the size of the returned matrix. Function column->number takes a column and returns a number.

Returns a row matrix created from `numbers` or from `size` and
`column->number`. `size` is the size of the returned matrix. Function
`column->number` takes a `column` and returns a number.
sourceraw docstring

row-matrix?clj

(row-matrix? x)

Returns true if a row-matrix (i.e., matrix with exactly one row)

Returns true if a row-matrix (i.e., matrix with exactly one row)
sourceraw docstring

rowsclj

(rows m)

Returns the number of rows.

Returns the number of rows.
sourceraw docstring

serialize-symmetric-or-triangular-matrixclj

(serialize-symmetric-or-triangular-matrix m)
(serialize-symmetric-or-triangular-matrix m
                                          {:provisdom.math.matrix/keys [by-row?]
                                           :or {by-row? true}})

Returns a vector that contains the upper (default) or lower half of the matrix. m doesn't have to be symmetric. Options: ::by-row? (default: true). Set to false to get lower triangular values instead of upper.

Returns a vector that contains the upper (default) or lower half of the
matrix. `m` doesn't have to be symmetric. Options: `::by-row?`
(default: true). Set to false to get lower triangular values instead of
upper.
sourceraw docstring

size-of-symmetric-or-triangular-matrixclj

(size-of-symmetric-or-triangular-matrix ecount)

Returns the size of the matrix given ecount. ecount is the number of independent symmetric or triangular matrix elements (the number of elements on the diagonal plus the number either above or below the diagonal).

Returns the size of the matrix given `ecount`. `ecount` is the number of
independent symmetric or triangular matrix elements (the number of elements on
the diagonal plus the number either above or below the diagonal).
sourceraw docstring

size-of-symmetric-or-triangular-matrix-without-diagonalclj

(size-of-symmetric-or-triangular-matrix-without-diagonal ecount)

Returns the size of the matrix given ecount. ecount is the number of elements above or below the diagonal.

Returns the size of the matrix given `ecount`. `ecount` is the number of
elements above or below the diagonal.
sourceraw docstring

some-kvclj

(some-kv pred m)
(some-kv pred m {:provisdom.math.matrix/keys [by-row?] :or {by-row? true}})

Returns the first logical true value of (pred row column number) for any number in matrix, else nil. Options: ::by-row? (default: true).

Returns the first logical true value of (pred row column number) for any
number in matrix, else nil. Options: `::by-row?` (default: true).
sourceraw docstring

sparse->matrixclj

(sparse->matrix sparse m)

Builds a matrix using a sparse representation and an existing matrix (often a zero-matrix). sparse is a vector of triples of [row column value]. Later values will override prior overlapping values.

Builds a matrix using a sparse representation and an existing matrix (often
a zero-matrix). `sparse` is a vector of triples of `[row column value]`. Later
values will override prior overlapping values.
sourceraw docstring

sparse->symmetric-matrixclj

(sparse->symmetric-matrix sparse symmetric-m)

Builds a symmetric matrix using a sparse representation and an existing symmetric matrix (often a zero-matrix). sparse is a vector of triples of [row column value]. Later values will override prior overlapping values. Each off-diagonal inner sparse form is applied twice, with the row and column switched.

Builds a symmetric matrix using a sparse representation and an existing
symmetric matrix (often a zero-matrix). `sparse` is a vector of triples of
[row column value]. Later values will override prior overlapping values.
Each off-diagonal inner sparse form is applied twice, with the row and column
switched.
sourceraw docstring

square-matrix?clj

(square-matrix? x)

Returns true if matrix is square (i.e., same number of rows and columns)

Returns true if matrix is square (i.e., same number of rows and columns)
sourceraw docstring

symmetric-matrix->sparseclj

(symmetric-matrix->sparse symmetric-m)
(symmetric-matrix->sparse symmetric-m number->bool)

Returns a sparse-matrix (i.e., a vector of tuples of [row column number]). number->bool takes a number and will be evaluated only for upper-right triangle of symmetric-m.

Returns a sparse-matrix (i.e., a vector of tuples of [row column number]).
`number->bool` takes a number and will be evaluated only for upper-right
triangle of `symmetric-m`.
sourceraw docstring

symmetric-matrix-by-averagingclj

(symmetric-matrix-by-averaging square-m)

Returns a symmetric matrix where each element above or below the diagonal is equal to the average of the corresponding numbers. This is useful to help with rounding errors.

Returns a symmetric matrix where each element above or below the diagonal is
equal to the average of the corresponding numbers. This is useful to help with
rounding errors.
sourceraw docstring

symmetric-matrix?clj

(symmetric-matrix? x)

Returns true if a symmetric matrix.

Returns true if a symmetric matrix.
sourceraw docstring

to-matrixclj

(to-matrix tensor rows)
(to-matrix tensor
           rows
           {:provisdom.math.matrix/keys [by-row?] :or {by-row? true}})

Builds a matrix representing the flattened elements of tensor (onto a matrix of zeros (doubles) if necessary). rows is the number of rows of the returned matrix. The elements are placed by-row? (default is true). To set the number of columns instead, transpose returned matrix.

Builds a matrix representing the flattened elements of `tensor` (onto a
matrix of zeros (doubles) if necessary). `rows` is the number of rows of the
returned matrix. The elements are placed `by-row?` (default is true). To set
the number of columns instead, transpose returned matrix.
sourceraw docstring

toeplitz-matrixclj

(toeplitz-matrix first-row first-column)

Returns a toeplitz matrix (a matrix whose elements on any diagonal are the same). A Toeplitz matrix is also called a diagonal-constant matrix. first-row is the first row in the matrix and first-column is the first column in the matrix.

Returns a toeplitz matrix (a matrix whose elements on any diagonal are the
same). A Toeplitz matrix is also called a diagonal-constant matrix.
`first-row` is the first row in the matrix and `first-column` is the first
column in the matrix.
sourceraw docstring

traceclj

(trace square-m)

Calculates the trace of a square matrix (sum of elements on main diagonal).

Calculates the trace of a square matrix (sum of elements on main diagonal).
sourceraw docstring

transposeclj

(transpose m)

Transposes a matrix by swapping rows and columns, returning a new matrix.

Transposes a matrix by swapping rows and columns, returning a new matrix.
sourceraw docstring

update-columnclj

(update-column m column row+number->number)

Updates a column of matrix m, using function row+number->number, which is a function the row and number and returns a number.

Updates a `column` of matrix `m`, using function `row+number->number`, which
is a function the `row` and `number` and returns a number.
sourceraw docstring

update-diagonalclj

(update-diagonal m row+number->number)

Updates the diagonal of matrix m, using function row+number->number, which is a function of the row and number and returns a number.

Updates the diagonal of matrix `m`, using function `row+number->number`,
which is a function of the `row` and `number` and returns a number.
sourceraw docstring

update-rowclj

(update-row m row column+number->number)

Updates a row of matrix m, using function column+number->number, which is a function of the column and number and returns a number.

Updates a `row` of matrix `m`, using function `column+number->number`, which
is a function of the `column` and `number` and returns a number.
sourceraw docstring

upper-triangular-matrix?clj

(upper-triangular-matrix? x)

Returns true if an upper triangular matrix (the entries below the main diagonal are all zero).

Returns true if an upper triangular matrix (the entries below the main
diagonal are all zero).
sourceraw docstring

zero-matrix?clj

(zero-matrix? x)

Returns true if all the elements of the matrix are zeros.

Returns true if all the elements of the matrix are zeros.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close