deodorant.broadcast-functions
broadcast-function-NxD-MxD
(broadcast-function-NxD-MxD op xs zs & b-Flip)
Performs an operation between a NxD array
and a MxD array, returning a NxDxM array.
Note if both inputs are NxD then the output
will be NxDxN.
Accepts: op - matrix operation to perform (must be from core.matrix)
xs - NxD array
zs - NxM array
bFlip - if true then NN is treated as
first input in op
Retuns: a NxDxM array
broadcast-function-NxDxN-NxN
(broadcast-function-NxDxN-NxN op NDN NN & b-Flip)
Performs an operation between a NxDxN array
and a NxN array.
Accepts: op - matrix operation to perform (must be from core.matrix)
NDN - NxDxN array
NN - NxN array
bFlip - if true then NN is treated as
first input in op
Retuns: a NxDxN array
safe-broadcast-op
(safe-broadcast-op op M1 M2 & b-Flip)
Calls broadcast-function-NxD-MxD when given arrays and
just does standard broadcasting if one is a vector.
See broadcast-function-NxD-MxD for details on call
structure.
safe-sum
(safe-sum X dim)
Sums out a dimension of nd-array. Takes an array
of matrix type and a dimension to sum out. Ensures
no crash if X is nil.
Accepts: X - matrix
dim - dimension to remove.
Returns: X with dim summed out
scale-square-diff
(scale-square-diff x-sq-diff rho)
Scales the output from square-diff. Care should be taken
to ensure inputs are of matrix type as will be slow
otherwise.
Accepts: x-sq-diff - NxDxM array to scale
rho - vector of length scales
Returns: the scaled version of x-sq-diff
square-diff
(square-diff xs)
Calculates array of squared differences. Accepts an [N D] array of
points xs. Returns an [N D N] array in which entry [i d j] is given
by (xs[i,d] - xs[j,d])^2.