Module type Gg.M
Implemented by all (square) matrix types.
Constructors, accessors and constants
val el : int -> int -> t -> floatel i j ais the elementaij.- raises Invalid_argument
if
iorjis not in [0;dim[.
Functions
val mul : t -> t -> tmul a bis the matrix multiplicationa * b.
val trace : t -> floattrace ais the matrix tracetrace(a).
val det : t -> floatdet ais the determinant|a|.
val inv : t -> tinv ais the inverse matrixa-1.
Traversal
val mapi : (int -> int -> float -> float) -> t -> tmapi f ais likemapbut the element indices are also given.
val fold : ('a -> float -> 'a) -> 'a -> t -> 'afold f acc aisf (...(f (f acc a00) a10)...).
val foldi : ('a -> int -> int -> float -> 'a) -> 'a -> t -> 'afoldi f acc aisf (...(f (f acc 0 0 a00) 1 0 a10)...).
val iter : (float -> unit) -> t -> unititer f aisf a00; f a10;...
val iteri : (int -> int -> float -> unit) -> t -> unititeri f aisf 0 0 a00; f 1 0 a10;...
Predicates and comparisons
val for_all : (float -> bool) -> t -> boolfor_all p aisp a00&& p a10&&...
val exists : (float -> bool) -> t -> boolexists p aisp a00|| p a10||...
val equal_f : (float -> float -> bool) -> t -> t -> boolequal_f eq a btestsaandblikeequalbut useseqto test floating point values.
Printers
val pp : Stdlib.Format.formatter -> t -> unitpp ppf aprints a textual representation ofaonppf.
val pp_f : (Stdlib.Format.formatter -> float -> unit) -> Stdlib.Format.formatter -> t -> unitpp_f pp_e ppf aprintsalikeppbut usespp_eto print floating point values.