The type of the entries of vectors and matrices does not need to be a Ring, it can be an AdditiveType or ArithmeticType respectively. This allows types that do not have a full equality such as SingleFloat or DenseUnivariateTaylorSeries to be entries of vectors and matrices. However, LinearAlgebra requires the entries to be from a CommutativeRing so its functionalities are not available for matrices of series or floating point numbers.
contains many fraction-free algorithms that
allow you to perform over an IntegralDomain
computations, such as matrix inverses or solving systems,
that are usually done over a Field. Those
algorithms are significantly faster over domains than
over their fraction fields, so consider using domains
such as
or
as matrix entries rather than
fractions. See for example the description of the
inverse function to see the
effect of working over domains rather than fields
on the signatures of the functions.
To write generic linear algebra code that does not depend on the implementation of matrices, use a type parameter of category MatrixCategory. For example, a normal form package could look like:
NormalForms(R:IntegralDomain, M:MatrixCategory R): with { frobenius: M -> M; -- Returns the Frobenius form of its argument ... } == add { ... }