Skip to content

Specialised matrices

Mike Anderson edited this page Jul 18, 2013 · 4 revisions

Vectorz supports a range of specialised matrix classes that provide more efficient operations on certain constrained matrix types.

The matrix hierarchy

  • AMatrix : base class for all matrix types
  • Matrix : general purpose matrix
  • Specialised matrices

When to use

Specialised matrices have both advantages and disadvantages: whether you use them or not is a judgement call. If in doubt, you should benchmark for your specific use case.

Pros:

  • Use much less storage space: e.g. a diagonal n*n matrix requires only n elements of storage
  • Provide fast, optimised operations

Cons:

  • Elements are constrained, so specialised matrices are usually not fully mutable
  • Slower for arbitrary operations not suited to this matrix type
Clone this wiki locally