CrossClj

0.5.0 docs

SourceDocs



RECENT
    VARS
    *
    *eps*
    +
    -
    ->Matrix
    ->Vector
    abs
    abs!
    acos
    acos!
    arbitrary
    arbitrary?
    as-vec
    asin
    asin!
    atan
    atan!
    block
    block-fn
    cbrt
    cbrt!
    ceil
    ceil!
    cholesky
    clatrix
    clatrix?
    cols
    column
    column?
    complex-power
    constant
    construct-clatrix
    cos
    cos!
    cosh
    cosh!
    dense
    det
    diag
    div
    dot
    dotom
    eigen
    eps-zero?
    ereduce
    exp
    exp!
    eye
    floor
    floor!
    from-indices
    from-sparse
    get
    hstack
    i
    int-arraytise
    iswild
    log
    log!
    log10
    log10!
    lu
    make-constr
    make-new-matrix
    map
    map!
    map-indexed
    matrix
    matrix?
    maybe-positive
    maybe-symmetric
    me
    mget
    mset!
    mult
    n-perms
    ncols
    norm
    normalize
    nrows
    ones
    permute
    permute-cols
    permute-rows
    positive
    positive?
    pow
    promote-cfun*
    promote-mffun*
    promote-mfun*
    qr
    rand
    randn*
    rank
    reshape
    reshape!
    rnorm
    row-list
    row?
    rows
    rreflection
    rspectral
    seed
    set
    signum
    signum!
    sin
    sin!
    sinh
    sinh!
    size
    slice
    slice-column
    slice-row
    slicer
    slices
    solve
    sqrt
    sqrt!
    square?
    sum
    svd
    symmetric
    symmetric?
    t
    tan
    tan!
    tanh
    tanh!
    to-matrix
    to-vecs
    trace
    uniquifier
    unseed
    update-hash-with-constr
    vec?
    vector
    vector-matrix?
    vstack
    with-seed
    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.
    (->Matrix me metadata)
    Positional factory function for class clatrix.core.Matrix.
    
    (->Vector me metadata)
    Positional factory function for class clatrix.core.Vector.
    
    (abs G__55982)
    (abs! G__56039)
    (acos G__55985)
    (acos! G__56042)
    (arbitrary m)
    arbitrary asserts that a matrix is just arbitrary.
    
    (as-vec m)
    as-vec converts a matrix object into a seq-of-seqs of its
    elements in row-major order. Treats vector? type matrices
    differently, though, flattening the return seq to a single vector.
    (asin G__55988)
    (asin! G__56045)
    (atan G__55991)
    (atan! G__56048)
    macro
    (block blockspec)
    block creates a block matrix using normal block matrix syntax
    written as a row-major 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.
    (block-fn matrices)
    block-fn 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 all-n matrix of an
    appropriate size to make the matrix.
    (cbrt G__55994)
    (cbrt! G__56051)
    (ceil G__55997)
    (ceil! G__56054)
    (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.
    (clatrix m)
    Coerces an arbitrary array to Clatrix format (a Matrix, a Vector or a number)
    
    (clatrix? m)
    Tests whether an object is either a clatrix Matrix or Vector
    
    (cols mat)(cols m idxs)
    cols explodes a Matrix into its constituent columns in the
    style of rows. See rows documentation for more detail.
    (column seq)
    column coerces a seq of numbers to a column Matrix.
    
    Private
    (complex-power z e)
    complex-power 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.
    Private
    (construct-clatrix m)
    (cos G__56000)
    (cos! G__56057)
    (cosh G__56003)
    (cosh! G__56060)
    (dense m)
    dense converts a matrix object into a seq-of-seqs of its elements
    in row-major order.
    (det mat)
    `(det A)` computes the determinant of A. Odd that there is no built in fn for this.
    
    (diag seq-or-matrix)
    diag creates a diagonal matrix from a seq of numbers or extracts
    the diagonal of a Matrix as a seq.
    (div a b)
    Element-wise division.
    
    (dot m1 m2)
    dot computes the inner product between two vectors. This is
    extended to work on matrices considered as nm-dimensional
    vectors.
    macro
    (dotom name m & args)
    (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 non-symmetric 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.
    Private
    (eps-zero? x)
    (ereduce fun mat)(ereduce fun init mat)
    Quick and dirty reduce.
    
    (exp G__56006)
    (exp! G__56063)
    (eye n)
    `(eye n)` is the n`x`n identity matrix.
    
    (floor G__56009)
    (floor! G__56066)
    (from-indices n m fun)
    from-indices builds an n`x`m matrix from a function mapping the
    indices to values which are then stored at that location.
    (from-sparse n m specs)(from-sparse n specs)
    from-sparse 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 sub-matrix. Pass in a single arg, i, so do row-first traversal index
    access.
    (hstack & vec-seq)
    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
    (int-arraytise x)
    Convert a seq to int array or pass through for a number.
    
    Private
    (iswild sym)
    iswild is a helper function that defines what a wildcard symbol
    is, used in block, slice, and slices.
    (log G__56012)
    (log! G__56069)
    (log10 G__56015)
    (log10! G__56072)
    (lu mat)
    `(lu A)` computes the LU decomposition of A, returning `{:p P :l L :u
    U}` such that `A = PLU`.
    Private
    (make-constr e)
    make-constr is a subfunction for block. Generates the
    size-constraint map based on the elements of the seqs in a block
    matrix specification.
    Private
    (make-new-matrix shape)
    Creates a new matrix filled with zeros
    
    (map fun mat)(map fun mat arg)(map fun mat arg & more)
    map is a specialization of map-indexed where the function does
    not get passed the indices.
    (map! fun a)(map! fun a b)
    Inplace version of map.
    
    (map-indexed fun mat)
    map-indexed 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 row-major order. The length of each seq must be
    identical or an error is throw.
    (matrix? m)
    matrix? tests whether an object is a clatrix Matrix object.
    
    (maybe-positive m)
    maybe-positive attempts to assert that a matrix is positive definite,
    but only succeeds if it actually is. (Checked via eigenvalue
    positivity.)
    (maybe-symmetric m)
    maybe-symmetric attempts to assert that a matrix is symmetric,
    but only succeeds if it actually is.
    (me mat)
    Accesses the underlying JBlas DoubleMatrix of a matrix or vector.
    
    macro
    (mget m r)(mget m r c)
    Fast macro implementation of get, a single value by indices only.
    
    macro
    (mset! m r v)(mset! m r c v)
    Fast macro implementation of set, a single value by indices only.
    
    (mult a b)
    Element-wise multiplication.
    
    Private
    (n-perms p)
    (ncols G__54983)
    (norm mat)
    norm computes the 2-norm of a vector or the Frobenius norm of a matrix.
    
    (normalize mat & [flags])
    normalize normalizes a matrix as a single column or collection of
    column vectors.
    (nrows G__54986)
    (ones G__55128)(ones G__55128 G__55129)
    (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.
    Private
    (permute-cols mat colspec)
    Private
    (permute-rows mat rowspec)
    (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.
    macro
    (promote-cfun* defname name fname)
    macro
    (promote-mffun* defname name fname)
    macro
    (promote-mfun* defname name fname)
    (qr mat)
    `(qr A)` computes the QR decomposition of A, returning `{:q Q :r R}` such
    that `A = QR`.
    (rand G__55204)(rand G__55204 G__55205)
    Private
    (randn* G__55209)(randn* G__55209 G__55210)
    (rank A)
    `(rank A)` is the rank of matrix A as computed by svd.
    
    (reshape A p q)
    `(reshape A p q)` coerces an n`x`m matrix to be p`x`q so long
    as `pq = nm`.
    (reshape! A p q)
    reshape! modifies matrix in place.
    
    (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.
    (rreflection n)
    `(rreflection n)` creates a random n-dimensional Householder
    reflection.
    (rspectral n-or-spectrum)
    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.
    (set m r c e)(set m r e)
    Sets a value in a matrix or vector. WARNING: Mutates the matrix or vector.
    
    (signum G__56018)
    (signum! G__56075)
    (sin G__56021)
    (sin! G__56078)
    (sinh G__56024)
    (sinh! G__56081)
    (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 size-conforming entry, row, or matrix to be
    inserted into the spec'd location.
    (slice-column m colnum)
    Slices a matrix to produce a vector representing a single row.
    
    (slice-row m rownum)
    Slices a matrix to produce a vector representing a single row.
    
    Private
    (slicer matrix rowspec colspec)(slicer matrix rowspec colspec values)
    macro
    (slices matrix rowspec colspec & values?)
    slices provides an identical interface to slice except that it
    returns a seq (or seq-of-seqs) 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.
    (sqrt G__56027)
    (sqrt! G__56084)
    (sum m)
    `(sum M)` computes the sum of all elements of M
    
    (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 non-zero 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
    
    (symmetric m)
    symmetric asserts that a matrix is symmetric.
    
    (t mat)
    `(t A)` is the transpose of A.
    
    (tan G__56030)
    (tan! G__56087)
    (tanh G__56033)
    (tanh! G__56090)
    Private
    (to-matrix m)
    Coerces to a clatrix matrix or vector.
    
    (to-vecs m)
    to-vecs converts a matrix object into a seq-of-seqs of its
    elements in row-major order. Unlike as-vec, does not flatten 1*n or n*1
    matrices into a single vector.
    (trace mat)
    trace computes the trace of a matrix, the sum of its diagonal elements.
    
    (unseed)
    When you are done changing the seed, you can go back to a pseudo-random seed.
    Uses the same algorithm as java's default Random constructor.
    Private
    (update-hash-with-constr hsh constr i j key)
    update-hash-with-const 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
    (vec? m)
    vec? tests whether an object is a clatrix Vector object.
    
    (vector m)(vector m meta-map)
    (vector-matrix? m)
    Returns true if m is nx1 or 1xn
    
    (vstack & vec-seq)
    vstack is vertical concatenation in the style of hstack. See
    hstack documentation for more detail.
    macro
    (with-seed n & body)
    If you want to control the scope of a seed you've set, you can use this convenient macro.
    
    (zeros G__55133)(zeros G__55133 G__55134)