Vec.MakeSourceMake takes as input the signature of an object language and generates a module to perform vector computations in this language.
module Monad : Basic_structures.Basic_intf.Codegen_monad with type 'a m = 'a Repr.mmodule S : Basic_structures.Basic_intf.Lang.Shape 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.mType 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.