Page
Library
Module
Module type
Parameter
Class
Class type
Source
Gg.VImplemented by all vector types.
dim is the dimension of vectors of type t.
The type for matrices representing linear transformations of dim space.
val comp : int -> t -> floatcomp i v is vi, the ith component of v.
Raises Invalid_argument if i is not in [0;dim[.
val infinity : tinfinity is the vector whose components are infinity.
val neg_infinity : tneg_infinity is the vector whose components are neg_infinity.
val basis : int -> tbasis i is the ith vector of an orthonormal basis of the vector space t with inner product dot.
Raises Invalid_argument if i is not in [0;dim[.
dot u v is the dot product u.v.
val norm : t -> floatnorm v is the norm |v| = sqrt v.v.
val norm2 : t -> floatnorm2 v is the squared norm |v|2 .
homogene v is the vector v/(comp (dim - 1) v) if comp (dim - 1) v <> 0 and v otherwise.
ltr m v is the linear transform mv.
Stdlib operatorsmapi f v is like map but the component index is also given.
val fold : ('a -> float -> 'a) -> 'a -> t -> 'afold f acc v is f (...(f (f acc v0) v1)...).
val foldi : ('a -> int -> float -> 'a) -> 'a -> t -> 'afoldi f acc v is f (...(f (f acc 0 v0) 1 v1)...).
val iter : (float -> unit) -> t -> unititer f v is f v0; f v1; ...
val iteri : (int -> float -> unit) -> t -> unititeri f v is f 0 v0; f 1 v1; ...
val for_all : (float -> bool) -> t -> boolfor_all p v is p v0 && p v1 && ...
val exists : (float -> bool) -> t -> boolexists p v is p v0 || p v1 || ...
equal_f eq u v tests u and v like equal but uses eq to test floating point values.
compare_f cmp u v compares u and v like compare but uses cmp to compare floating point values.
val pp : Format.formatter -> t -> unitpp ppf v prints a textual representation of v on ppf.
val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> t -> unitpp_f pp_comp ppf v prints v like pp but uses pp_comp to print floating point values.