Mat.MakeSourceMake takes as input the signature of an object language and generates a module to perform matrix computations in this language.
module Monad : Basic_structures.Basic_intf.Codegen_monad with type 'a m = 'a Repr.mmodule B : Basic_structures.Basic_intf.Lang.Bool with type 'a m = 'a Repr.mmodule R : Basic_structures.Basic_intf.Lang.Ring with type 'a m = 'a Repr.mmodule E : Basic_structures.Basic_intf.Lang.Exn with type 'a m = 'a Repr.mmodule M : Basic_structures.Basic_intf.Lang.Sequencing with type 'a m = 'a Repr.mmodule P : Basic_structures.Basic_intf.Lang.Product with type 'a m = 'a Repr.mtype index := base_index * base_indexinclude Intf.Vec
with type 'a k := 'a k
and type 'a m := 'a m
and type 'a shape := 'a shape
with type ('a, 'b) morphism = ('a, 'b) S.Morphism.t
with type elt = R.tType of shape morphisms.
Creates an input vector from a dimension and a function.
Get an elemement of an input vector. Does not perform bound checking.
basis s i r is the vector of shape s everywhere equal to R.zero except at index i where it is equal to r. Raises Out_of_bounds if i does not belong to s.
Pointwise addition. Raises Dimensions_mismatch if the shape of operands are not equal.
Pointwise subtraction. Raises Dimensions_mismatch if the shape of operands are not equal.
Pointwise multiplication. Raises Dimensions_mismatch if the shape of operands are not equal.
Swapping of indices. Raises Out_of_bounds if given indices are invalid.
iter v iterates the effectful computation at each index
reduce op zero v folds the binary, associative operator op over the elements of v with initial value zero. Fold ordering is implementation-dependent: consider using commutative operators.
val (:=) :
('i shape, 'i m, 'a m, unit m) Intf.ovec ->
('i shape, 'i m, 'a m) Intf.vec ->
unit m kVector assignement.
Pointwise addition, stores result in first operand.
Pointwise subtraction, stores result in first operand.
Pointwise multiplication, stores result in first operand.
Indexing
cols m returns the shape of the columns of m.
rows m returns the shape of the rows of m
Identity matrix
Square matrix with given vector on diagonal
Get a column.
Convert a vector into a matrix with this vector as single column.
Get a row.
Convert a vector into a matrix with this vector as single row.
Swap two rows.
Swap two columns.
Concatenate two matrices horizontally, provided they have the same number of rows.
Concatenate two matrices vertically, provided they have the same number of columns.