Module type Gg.V
Implemented by all vector types.
val dim : intdimis the dimension of vectors of typet.
type mThe type for matrices representing linear transformations of
dimspace.
Constructors, accessors and constants
val comp : int -> t -> floatcomp i visvi, theith component ofv.- raises Invalid_argument
if
iis not in [0;dim[.
val infinity : tinfinityis the vector whose components areinfinity.
val neg_infinity : tneg_infinityis the vector whose components areneg_infinity.
val basis : int -> tbasis iis theith vector of an orthonormal basis of the vector spacetwith inner productdot.- raises Invalid_argument
if
iis not in [0;dim[.
Functions
val dot : t -> t -> floatdot u vis the dot productu.v.
val norm : t -> floatnorm vis the norm|v| = sqrt v.v.
val norm2 : t -> floatnorm2 vis the squared norm|v|2 .
val homogene : t -> thomogene vis the vectorv/(comp (dim - 1) v)ifcomp (dim - 1) v <> 0andvotherwise.
val ltr : m -> t -> tltr m vis the linear transformmv.
Overridden Pervasives operators
Traversal
val mapi : (int -> float -> float) -> t -> tmapi f vis likemapbut the component index is also given.
val fold : ('a -> float -> 'a) -> 'a -> t -> 'afold f acc visf (...(f (f acc v0) v1)...).
val foldi : ('a -> int -> float -> 'a) -> 'a -> t -> 'afoldi f acc visf (...(f (f acc 0 v0) 1 v1)...).
val iter : (float -> unit) -> t -> unititer f visf v0; f v1;...
val iteri : (int -> float -> unit) -> t -> unititeri f visf 0 v0; f 1 v1;...
Predicates and comparisons
val for_all : (float -> bool) -> t -> boolfor_all p visp v0&& p v1&&...
val exists : (float -> bool) -> t -> boolexists p visp v0|| p v1||...
Printers
val pp : Stdlib.Format.formatter -> t -> unitpp ppf vprints a textual representation ofvonppf.
val pp_f : (Stdlib.Format.formatter -> float -> unit) -> Stdlib.Format.formatter -> t -> unitpp_f pp_comp ppf vprintsvlikeppbut usespp_compto print floating point values.