forked from mikera/core.matrix
-
Notifications
You must be signed in to change notification settings - Fork 1
Core design ideas
Dmitry Groshev edited this page Jul 22, 2013
·
7 revisions
This page serves as a reference of design ideas that lay in core of core.matrix.
- explicitness is preferred;
- except when the contrary stated in documentation or makes no sense, all functions receive arguments of identical dimensionality and shape (example: in
(add a b)
a and b should be of the same shape; in(mul a b)
a and b should be of same dimensionality, if you want to multiply matrix (2d) by vector (1d), pleasereshape
the vector to column or row matrix); -
reshape
andbroadcast
should be fast; - it is assumed by default implementations of protocols that
get-
(andset-…!
for mutable implementations) are fast and that the data is arranged in row-major order in memory (so the access is as sequential as possible); - when it's motivated by performance reasons, default protocol implementations can coerce at least one input argument to NDArray (copying the data) and return NDArray instead of original datatype (
mul
on immutable implementations is one of examples); this effect should be stated indefault.clj
in documentation for protocol implementation.