Skip to content

Instantly share code, notes, and snippets.

@jeremyrsellars
Last active August 15, 2019 13:17
Show Gist options
  • Save jeremyrsellars/f1c87bfd998426479aad74cf182f8c96 to your computer and use it in GitHub Desktop.
Save jeremyrsellars/f1c87bfd998426479aad74cf182f8c96 to your computer and use it in GitHub Desktop.
core.matrix Cheatsheet

Core Matrix Cheatsheet

  • An attempt to categorize operations by their effect on the shape of the data.

Apply to all elements (unary)

  • abs
  • acos
  • asin
  • atan
  • cbrt (cubed-root)
  • ceil
  • cos
  • cosh
  • exp
  • floor
  • log
  • log10
  • logistic
  • negate
  • pow
  • round
  • signum
  • sin
  • sinh
  • sqrt
  • square
  • tan
  • tanh
  • to-degrees
  • to-radians

Other Unary

  • clone
  • dense
  • density
  • ecount
  • element-type
  • emax
  • emin
  • esum
  • length
  • length-squared
  • non-zero-count
  • normalize
  • pack
  • sparse
  • zero-count

Dimensions

  • column-count
  • row-count
  • shape
  • slice-count

Element-wise binary (may include more and/or less arity)

  • add
  • cmp ; as-if (emap sign (sub a b))
  • div
  • e*
  • e=
  • e==
  • emul
  • eq
  • ne
  • scale
  • sub

Element-wise (same shape)

  • add-product
  • add-scaled
  • add-scaled-product
  • assign
  • clamp ; like (max (min m))
  • eif
  • emap
  • emap-indexed
  • ge
  • gt
  • le
  • lt
  • scale-add

Other Binary

  • cross
  • distance
  • equals
  • ge
  • le
  • inner-product
  • mmul
  • outer-product

One array -> 1 array with same shape

add-row

Change shape

  • reshape
  • broadcast
  • transpose

Make bigger

  • loin
  • join-along
  • brodcast
  • order
  • reshape

Make smaller

  • order
  • reshape

Change data

  • broadcast-like
  • fill
  • assign
  • multiply-row
  • rotate
  • set-column
  • set-indices
  • set-row
  • set-selection
  • shift
  • swap-rows

Create array

  • array
  • block-diagonal-matrix
  • column-matrix
  • compute-matrix
  • diagonal-matrix
  • identity-matrix
  • matrix
  • new-array
  • new-matrix
  • new-scalar-array
  • new-sparse-array
  • new-vector
  • permutation-matrix
  • row-matrix
  • scalar-array
  • sparse-array
  • sparse-matrix
  • zero-array
  • zero-matrix

Specific value(s)

  • mget
  • mset
  • scalar
  • select
  • slice
  • slice-view
  • slice-views
  • slices
  • submatrix
  • subvector

Test

  • array?
  • column-matrix?
  • conforming?
  • diagonal?
  • identity-matrix?
  • index?
  • lower-triangular?
  • mutable?
  • native?
  • numerical?
  • orthogonal?
  • column-matrix?
  • same-shape?
  • scalar?
  • sparse?
  • supports-dimensionality?
  • supports-shape?
  • symmetric?
  • upper-triangular?
  • vec?
  • zero-dimensional?
  • zero-matrix?
  • Coerce

  • as-vector
  • to-vector
  • ensure-mutable
  • immutable
  • mutable

traverse

  • ereduce
  • eseq
  • rows
  • Change implementation

  • broadcast-coerce
  • native
  • change-implementation
  • to-double-array
  • to-nested-vectors
  • to-object-array
  • with-implementation
  • Matrix->vector

  • diagonal
  • get-column
  • get-row
  • main-diagonal
  • to-vector
  • Other

  • pm

unknown

  • det
  • index
  • index-seq
  • index-seq-for-shape
  • inverse
  • label
  • labels
  • permutation-matrix
  • select-view
  • trace
  • transform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment