Library
Module
Module type
Parameter
Class
Class type
Tensor core type:
val pp : Format.formatter -> ('dim, 'rank) t -> unit
Printer function
type +'x scalar = ('a Type_functions.one, 'b Type_functions.z) t constraint 'x = 'a * 'b
Type abreviations
type +'x vec2 = ('a Type_functions.two, 'b Type_functions.one) t constraint 'x = 'a * 'b
type +'x vec3 = ('a Type_functions.three, 'b Type_functions.one) t constraint 'x = 'a * 'b
type +'x vec4 = ('a Type_functions.four, 'b Type_functions.one) t constraint 'x = 'a * 'b
type +'x mat2 = ('a Type_functions.two, 'b Type_functions.two) t constraint 'x = 'a * 'b
type +'x mat3 = ('a Type_functions.three, 'b Type_functions.two) t constraint 'x = 'a * 'b
type +'x mat4 = ('a Type_functions.four, 'b Type_functions.two) t constraint 'x = 'a * 'b
scalar f
build a scalar from the naked scalar type. It can be abbreviated to (+s)
.
val vec2' :
([< _ Type_functions.one | _ Type_functions.two ],
[< _ Type_functions.one | _ Type_functions.z ])
t ->
_ vec2
vec$n' v
extends a vector of dimension d <= n
to a vector of dimension n by repeating the last value of the vector
val vec3' :
([< _ Type_functions.one | _ Type_functions.two | _ Type_functions.three ],
[< _ Type_functions.one | _ Type_functions.z ])
t ->
_ vec3
val vec4' :
([< _ Type_functions.one
| _ Type_functions.two
| _ Type_functions.three
| _ Type_functions.four ],
[< _ Type_functions.one | _ Type_functions.z ])
t ->
_ vec4
val (|+|) :
(('dim1, 'dim2, 'dim3, _) Type_functions.nat_sum,
[< _ Type_functions.one | _ Type_functions.z ])
t ->
('dim2, [< _ Type_functions.one | _ Type_functions.z ]) t ->
('dim3, _ Type_functions.one) t
Vector concatenation : v |+| w
is (v_0, v_1, … , v_{dim-1}, w_0, …, w_{dim-1})
val (+) :
('dim1, ('rank1, 'rank2, 'rank3, 'dim1, 'dim2, 'dim3, _) Type_functions.sum)
t ->
('dim2, 'rank2) t ->
('dim3, 'rank3) t
x + y
is the standard vector sum, except for scalar argument which are broadcasted to a constant tensor
x <+> y
is the standard vector sum, without broadcasting
val (-) :
('a, ('rank1, 'rank2, 'rank3, 'dim1, 'dim2, 'dim3, _) Type_functions.sum) t ->
('a, 'rank2) t ->
('a, 'rank3) t
x - y
is the standard vector difference, except for scalar argument which are broadcasted to a constant tensor
x <-> y
is the standard vector difference, without broadcasting
val (*) :
('dim1,
('rank1, 'rank2, 'rank3, 'dim1, 'dim2, 'dim3, _) Type_functions.product)
t ->
('dim2, 'rank2) t ->
('dim3, 'rank3) t
x * y
is:
val (/) :
('dim1, ('rank1, 'rank2, 'rank3, 'dim1, 'dim2, 'dim3, _) Type_functions.div)
t ->
('dim2, 'rank2) t ->
('dim3, 'rank3) t
x / y
is:
exp
is the algebraic exponential: exp m = 1 + m + m ** 2 / 2 + m **3 / 3! + …
val orthonormalize :
('dim, _ Type_functions.one) t list ->
('dim, _ Type_functions.one) t list
orthonomalize [v_0;...;v_n]
returns a list of orthonormal vectors [w_0;...;w_k]
that spans the same vector subspace as v_0;...;v_n
. If the family [v_0;...;v_n]
was free then k = n
, otherwise k<n
.
val cross :
(('dim, 'dim2 * 'rank2, _) Type_functions.cross, _ Type_functions.one) t ->
('dim, _ Type_functions.one) t ->
('dim2, 'rank2) t
cross v w
is the cross product, it maps either two 3d vectors to a 3d pseudo-vector, or two 2d vectors to a scalar
val (^) :
('dim, _ Type_functions.one) t ->
('dim, _ Type_functions.one) t ->
('dim, _ Type_functions.two) t
See cross
for the 2d and 3d cross-product for vectors v ^ w
is the infinitesimal rotation matrix in the plane generated by v
and w
with an amplitude |v||w| sin θ
. In other words the matrix representation of the 2-form dv ^ dw
in the corresponding graded algebra.
val commutator :
('dim, _ Type_functions.two) t ->
('dim, _ Type_functions.two) t ->
('dim, _ Type_functions.two) t
commutator m n
is m * n - n * m
val anticommutator :
('dim, _ Type_functions.two) t ->
('dim, _ Type_functions.two) t ->
('dim, _ Type_functions.two) t
anticommutator m n
is m * n + n * m
val trace : ('dim, _ Type_functions.two) t -> k
trace m
is ∑_i m_ii
val det : ('dim, _ Type_functions.two) t -> k
det m
is the signed volume of the convex hull of of the matrix rows
val transpose :
('dim, _ Type_functions.two) t ->
('dim, _ Type_functions.two) t
transpose m
is the matrix with row and column reversed