## arithmetic/src/linearalgebra/matrix/matrix.tmpl

```%
%  Quake functions to instantiate operations on generic matrices.
%

readonly proc MatrixBasic (nm, rfield) is
local vector   = nm & "Vector"
local vrep     = nm & "VectorRep"
local base     = nm & "Matrix"
local impl     = base & "Basic"
MatrixGeneral(nm, rfield, "Basic")
build_generic_impl (impl, "MatrixBasic", [rfield, vector, vrep])
end

readonly proc MatrixFast (nm, rfield) is
local vector   = nm & "Vector"
local base     = nm & "Matrix"
local impl     = base & "Fast"
local support  = nm & "MatrixSupport"
local decomp   = nm & "MatrixDecomposition"
MatrixGeneral(nm, rfield, "Fast")
build_generic_impl (impl, "MatrixFast", [rfield, vector, support, decomp])
end

readonly proc MatrixGeneral (nm, rfield, implsuf) is
local vector   = nm & "Vector"
local base     = nm & "Matrix"
local support  = nm & "MatrixSupport"
local impl     = base & implsuf
build_generic_intf (impl, "Matrix" & implsuf, [rfield, vector, support], VISIBLE)
build_generic_intf (base,    "Matrix",        [rfield, vector, support, impl], VISIBLE)
build_generic_impl (base,    "Matrix",        [rfield, vector])
build_generic_intf (support, "MatrixSupport", [rfield], VISIBLE)
build_generic_impl (support, "MatrixSupport", [rfield])
end

readonly proc MatrixTrans (nm, field) is
local rfield = field & "Basic"
local rtrans = field & "Trans"
local ctrans = nm & "Trans"
local cvsup  = nm & "VectorRep"
local mfield = nm & "Matrix"
local mtrans = nm & "MatrixTrans"
local eigen  = nm & "EigenSystem"
build_generic_intf (mtrans, "MatrixTrans", [rfield,                        mfield], VISIBLE)
build_generic_impl (mtrans, "MatrixTrans", [rfield, rtrans, ctrans, cvsup, mfield, eigen])
end

readonly proc MatrixDecomposition (nm, rfield) is
local basic   = nm & "MatrixDecomposition"
local rtrans  = nm & "Trans"
local vector  = nm & "Vector"
local vrep    = nm & "VectorRep"
local mfield  = nm & "Matrix"
build_generic_intf (basic, "MatrixDecomposition", [rfield,         vector, mfield], VISIBLE)
build_generic_impl (basic, "MatrixDecomposition", [rfield, rtrans, vector, mfield])
end

readonly proc EigenSystem (nm, rfield, cfield) is
local basic   = nm & "EigenSystem"
local rtrans  = nm & "Trans"
local vector  = nm & "Vector"
local vrep    = nm & "VectorRep"
local cvector = cfield & "Vector"
local mfield  = nm & "Matrix"
build_generic_intf (basic, "EigenSystem", [        rtrans, vector, cvector, mfield], VISIBLE)
build_generic_impl (basic, "EigenSystem", [rfield, rtrans, vector, mfield])
end

readonly proc CharPolynomial (nm, rfield) is
local basic   = nm & "CharPolynomial"
local rtfield = nm & "Root"
local mfield  = nm & "Matrix"
build_generic_intf (basic, "CharPolynomial", [        rtfield, mfield], VISIBLE)
build_generic_impl (basic, "CharPolynomial", [rfield, rtfield, mfield])
end

readonly proc MatrixFmtLex (nm, rfield) is
local rfmt   = nm & "FmtLex"
local vector = nm & "Vector"
local vfmt   = nm & "VectorFmtLex"
local mfield = nm & "Matrix"
local mfmt   = nm & "MatrixFmtLex"
build_generic_intf (mfmt, "MatrixFmtLex", [rfmt,               mfield], VISIBLE)
build_generic_impl (mfmt, "MatrixFmtLex", [rfmt, vector, vfmt, mfield])
end
```
```

```