module Mat:sig..end
val hilbert : int -> Lacaml_float64.mathilbert n
nxn Hilbert matrix.val hankel : int -> Lacaml_float64.mathankel n
nxn Hankel matrix.val pascal : int -> Lacaml_float64.matpascal n
nxn Pascal matrix.val rosser : unit -> Lacaml_float64.matrosser n
val toeplitz : Lacaml_float64.vec -> Lacaml_float64.mattoeplitz v
Invalid_argument if the length of v is not an odd number.v.
The constant diagonals are read from left to right from v.val vandermonde : Lacaml_float64.vec -> Lacaml_float64.matvandermonde v
v.val wilkinson : int -> Lacaml_float64.matwilkinson n
Invalid_argument if n is not an odd number >= 3.nxn Wilkinson matrix.val random : ?rnd_state:Stdlib.Random.State.t ->
?from:float -> ?range:float -> int -> int -> Lacaml_float64.matrandom ?rnd_state ?from ?range m n
mxn matrix
initialized with random elements sampled uniformly from range
starting at from. A random state rnd_state can be passed.rnd_state : default = Random.get_state ()from : default = -1.0range : default = 2.0val create : int -> int -> Lacaml_float64.matcreate m n
m rows and n columns.val make : int -> int -> Lacaml_float64.num_type -> Lacaml_float64.matmake m n x
m rows and n columns
initialized with value x.val make0 : int -> int -> Lacaml_float64.matmake0 m n x
m rows and n columns
initialized with the zero element.val of_array : Lacaml_float64.num_type array array -> Lacaml_float64.matof_array ar
ar. It is assumed that the OCaml matrix is in row major order
(standard).val to_array : Lacaml_float64.mat -> Lacaml_float64.num_type array arrayto_array mat
mat.val of_col_vecs : Lacaml_float64.vec array -> Lacaml_float64.matof_col_vecs ar
ar. The vectors must be of same length.val to_col_vecs : Lacaml_float64.mat -> Lacaml_float64.vec arrayto_col_vecs mat
mat.val as_vec : Lacaml_float64.mat -> Lacaml_float64.vecas_vec mat
val init_rows : int -> int -> (int -> int -> Lacaml_float64.num_type) -> Lacaml_float64.matinit_cols m n f
m rows and n
columns, where each element at row and col is initialized by the
result of calling f row col. The elements are passed row-wise.val init_cols : int -> int -> (int -> int -> Lacaml_float64.num_type) -> Lacaml_float64.matinit_cols m n f
m rows and n
columns, where each element at row and col is initialized by the
result of calling f row col. The elements are passed column-wise.val create_mvec : int -> Lacaml_float64.matcreate_mvec m
m rows.val make_mvec : int -> Lacaml_float64.num_type -> Lacaml_float64.matmake_mvec m x
m rows
initialized with value x.val mvec_of_array : Lacaml_float64.num_type array -> Lacaml_float64.matmvec_of_array ar
ar.val mvec_to_array : Lacaml_float64.mat -> Lacaml_float64.num_type arraymvec_to_array mat
mat.val from_col_vec : Lacaml_float64.vec -> Lacaml_float64.matfrom_col_vec v
v.
The data is shared.val from_row_vec : Lacaml_float64.vec -> Lacaml_float64.matfrom_row_vec v
v.
The data is shared.val empty : Lacaml_float64.matempty, the empty matrix.
val identity : int -> Lacaml_float64.matidentity n
nxn identity matrix.val of_diag : Lacaml_float64.vec -> Lacaml_float64.matof_diag v
v.val dim1 : Lacaml_float64.mat -> intdim1 m
m (number of rows).val dim2 : Lacaml_float64.mat -> intdim2 m
m (number of columns).val col : Lacaml_float64.mat -> int -> Lacaml_float64.veccol m n
nth column of matrix m as a vector.
The data is shared.val copy_row : ?vec:Lacaml_float64.vec -> Lacaml_float64.mat -> int -> Lacaml_float64.veccopy_row ?vec mat int
nth row of matrix m
in vector vec.vec : default = fresh vector of length dim2 matval transpose_copy : ?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_float64.mat -> ?br:int -> ?bc:int -> Lacaml_float64.mat -> unittranspose_copy ?m ?n ?ar ?ac a ?br ?bc b copy the transpose
of (sub-)matrix a into (sub-)matrix b.
m : default = Mat.dim1 an : default = Mat.dim2 aar : default = 1ac : default = 1br : default = 1bc : default = 1val transpose : ?m:int ->
?n:int -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.mattranspose ?m ?n ?ar ?ac aa
a.m : default = Mat.dim1 an : default = Mat.dim2 aar : default = 1ac : default = 1val detri : ?up:bool -> ?n:int -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> unitdetri ?up ?n ?ar ?ac a takes a triangular (sub-)matrix a, i.e. one
where only the upper (iff up is true) or lower triangle is defined,
and makes it a symmetric matrix by mirroring the defined triangle
along the diagonal.
up : default = truen : default = Mat.dim1 aar : default = 1ac : default = 1val packed : ?up:bool ->
?n:int -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.vecpacked ?up ?n ?ar ?ac a
a in packed
storage format.up : default = truen : default = Mat.dim2 aar : default = 1ac : default = 1val unpacked : ?up:bool -> ?n:int -> Lacaml_float64.vec -> Lacaml_float64.matunpacked ?up x
up)
triangular matrix from packed representation vec. The other
triangle of the matrix will be filled with zeros.up : default = truen : default = Vec.dim xval add_const : Lacaml_float64.num_type ->
?m:int ->
?n:int ->
?br:int ->
?bc:int ->
?b:Lacaml_float64.mat ->
?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.matadd_const c ?m ?n ?br ?bc ?b ?ar ?ac a adds constant c to the
designated m by n submatrix in a and stores the result in the
designated submatrix in b.
m : default = Mat.dim1 an : default = Mat.dim2 abr : default = 1bc : default = 1b : default = fresh matrix of size m by nar : default = 1ac : default = 1val sum : ?m:int ->
?n:int -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.num_typesum ?m ?n ?ar ?ac a computes the sum of all elements in
the m-by-n submatrix starting at row ar and column ac.
val fill : ?m:int ->
?n:int ->
?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.num_type -> unitfill ?m ?n ?ar ?ac a x fills the specified sub-matrix in a with value
x.
val copy_diag : Lacaml_float64.mat -> Lacaml_float64.veccopy_diag m
m as a vector.
If m is not a square matrix, the longest possible sequence
of diagonal elements will be returned.val trace : Lacaml_float64.mat -> Lacaml_float64.num_typetrace m
m. If m is not a
square matrix, the sum of the longest possible sequence of
diagonal elements will be returned.val scal : ?m:int ->
?n:int ->
Lacaml_float64.num_type -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> unitscal ?m ?n alpha ?ar ?ac a BLAS scal function for (sub-)matrices.
val scal_cols : ?m:int ->
?n:int ->
?ar:int ->
?ac:int -> Lacaml_float64.mat -> ?ofs:int -> Lacaml_float64.vec -> unitscal_cols ?m ?n ?ar ?ac a ?ofs alphas column-wise scal
function for matrices.
val scal_rows : ?m:int ->
?n:int ->
?ofs:int ->
Lacaml_float64.vec -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> unitscal_rows ?m ?n ?ofs alphas ?ar ?ac a row-wise scal
function for matrices.
val axpy : ?alpha:Lacaml_float64.num_type ->
?m:int ->
?n:int ->
?xr:int ->
?xc:int ->
Lacaml_float64.mat -> ?yr:int -> ?yc:int -> Lacaml_float64.mat -> unitaxpy ?alpha ?m ?n ?xr ?xc x ?yr ?yc y BLAS axpy function for
matrices.
val gemm_diag : ?n:int ->
?k:int ->
?beta:Lacaml_float64.num_type ->
?ofsy:int ->
?y:Lacaml_float64.vec ->
?transa:Lacaml_float64.trans3 ->
?alpha:Lacaml_float64.num_type ->
?ar:int ->
?ac:int ->
Lacaml_float64.mat ->
?transb:Lacaml_float64.trans3 ->
?br:int -> ?bc:int -> Lacaml_float64.mat -> Lacaml_float64.vecgemm_diag ?n ?k ?beta ?ofsy ?y ?transa ?transb ?alpha ?ar ?ac a ?br ?bc b
computes the diagonal of the product of the (sub-)matrices a
and b (taking into account potential transposing), multiplying
it with alpha and adding beta times y, storing the result in
y starting at the specified offset. n elements of the diagonal
will be computed, and k elements of the matrices will be part of
the dot product associated with each diagonal element.
n : default = number of rows of a (or tr a) and
number of columns of b (or tr b)k : default = number of columns of a (or tr a) and
number of rows of b (or tr b)beta : default = 0ofsy : default = 1y : default = fresh vector of size n + ofsy - 1transa : default = `Nalpha : default = 1ar : default = 1ac : default = 1transb : default = `Nbr : default = 1bc : default = 1val syrk_diag : ?n:int ->
?k:int ->
?beta:Lacaml_float64.num_type ->
?ofsy:int ->
?y:Lacaml_float64.vec ->
?trans:Lacaml_common.trans2 ->
?alpha:Lacaml_float64.num_type ->
?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.vecsyrk_diag ?n ?k ?beta ?ofsy ?y ?trans ?alpha ?ar ?ac a
computes the diagonal of the symmetric rank-k product of the
(sub-)matrix a, multiplying it with alpha and adding beta
times y, storing the result in y starting at the specified
offset. n elements of the diagonal will be computed, and k
elements of the matrix will be part of the dot product associated
with each diagonal element.
n : default = number of rows of a (or tra)k : default = number of columns of a (or tra)beta : default = 0ofsy : default = 1y : default = fresh vector of size n + ofsy - 1trans : default = `Nalpha : default = 1ar : default = 1ac : default = 1val gemm_trace : ?n:int ->
?k:int ->
?transa:Lacaml_float64.trans3 ->
?ar:int ->
?ac:int ->
Lacaml_float64.mat ->
?transb:Lacaml_float64.trans3 ->
?br:int -> ?bc:int -> Lacaml_float64.mat -> Lacaml_float64.num_typegemm_trace ?n ?k ?transa ?ar ?ac a ?transb ?br ?bc b computes
the trace of the product of the (sub-)matrices a and b (taking into
account potential transposing). This is also sometimes referred to as
the Frobenius product. n is the number of rows (columns) to consider in
a, and k the number of columns (rows) in b.
n : default = number of rows of a (or tr a) and
number of columns of b (or tr b)k : default = number of columns of a (or tr a) and
number of rows of b (or tr b)transa : default = `Nar : default = 1ac : default = 1transb : default = `Nbr : default = 1bc : default = 1val syrk_trace : ?n:int ->
?k:int -> ?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.num_typesyrk_trace ?n ?k ?ar ?ac a computes the trace of either a' * a
or a * a', whichever is more efficient (results are identical), of the
(sub-)matrix a multiplied by its own transpose. This is the same as
the square of the Frobenius norm of a matrix. n is the number of rows
to consider in a, and k the number of columns to consider.
n : default = number of rows of ak : default = number of columns of aar : default = 1ac : default = 1val symm2_trace : ?n:int ->
?upa:bool ->
?ar:int ->
?ac:int ->
Lacaml_float64.mat ->
?upb:bool ->
?br:int -> ?bc:int -> Lacaml_float64.mat -> Lacaml_float64.num_typesymm2_trace ?n ?upa ?ar ?ac a ?upb ?br ?bc b computes the
trace of the product of the symmetric (sub-)matrices a and
b. n is the number of rows and columns to consider in a
and b.
n : default = dimensions of a and bupa : default = true (upper triangular portion of a is accessed)ar : default = 1ac : default = 1upb : default = true (upper triangular portion of b is accessed)br : default = 1bc : default = 1val map : (Lacaml_float64.num_type -> Lacaml_float64.num_type) ->
?m:int ->
?n:int ->
?br:int ->
?bc:int ->
?b:Lacaml_float64.mat ->
?ar:int -> ?ac:int -> Lacaml_float64.mat -> Lacaml_float64.matmap f ?m ?n ?br ?bc ?b ?ar ?ac a
f applied to each element of a.m : default = number of rows of an : default = number of columns of ab : default = fresh matrix of size m by nval fold_cols : ('a -> Lacaml_float64.vec -> 'a) ->
?n:int -> ?ac:int -> 'a -> Lacaml_float64.mat -> 'afold_cols f ?n ?ac acc a
n : default = number of columns of aac : default = 1