clojure.core.matrix.implementations

Namespace for management of core.matrix implementations. Users should avoid using these
functions directly as they are intended for library and tool writers.

*debug-options*

dynamic

A dynamic var supporting debugging option for core.matrix implementers.

Currently supported values:
  :print-registrations  - print when core.matrix implementations are registered

*matrix-implementation*

dynamic

A dynamic var specifying the current core.matrix implementation in use. 

May be re-bound to temporarily use a different core.matrix implementation.

canonical-objects

An atom holding a map of canonical objects for each loaded core.matrix implementation.

Canonical objects may be used to invoke protocol methods on an instance of the correct
type to get implementation-specific behaviour. Canonical objects are required to support
all mandatory core.matrix protocols.

construct

(construct m data)
Attempts to construct an array according to the type of array m. If not possible,
returns another array type.

DEFAULT-IMPLEMENTATION

The default implementation used in core.matrix. Currently set to `:persistent-vector` for maximum 
compatibility with regular Clojure code.

get-canonical-object

(get-canonical-object)(get-canonical-object m)
Gets the canonical object for a specific implementation. The canonical object is used
to call implementation-specific protocol functions where required (e.g. creation of new
arrays of the correct type for the implementation).

Returns nil if the implementation cannot be found.

get-canonical-object-or-throw

(get-canonical-object-or-throw mk)
Like get-canonical-object, except it throws an exception if the implementation cannot be found

get-implementation-key

(get-implementation-key m)
Returns the implementation keyword  for a given object

KNOWN-IMPLEMENTATIONS

A map of known core.matrix implementation namespaces. 

core.matrix will attempt to load these namespaces when an array of the specified 
keyword type is requested.

load-implementation

(load-implementation korm)
Attempts to load the implementation for a given keyword or matrix object.
Returns nil if not possible, a non-nil matrix value of the correct implementation otherwise.

register-implementation

(register-implementation canonical-object)(register-implementation key canonical-object)
Registers a matrix implementation for use. Should be called by all implementations
when they are loaded, once for each implementation keyword registered. Safe to call multiple times.

set-current-implementation

(set-current-implementation m)
Sets the currently active core.matrix implementation. 

Parameter may be 
 - A known keyword for the implementation e.g. :vectorz
 - An existing instance from the implementation

This is used primarily for functions that construct new matrices, i.e. it determines the
implementation used for expressions like: (matrix [[1 2] [3 4]])