Library
Module
Module type
Parameter
Class
Class type
val random :
?rnd_state:Stdlib.Random.State.t ->
?re_from:float ->
?re_range:float ->
?im_from:float ->
?im_range:float ->
int ->
int ->
Lacaml_complex64.mat
random ?rnd_state ?re_from ?re_range ?im_from ?im_range m n
val create : int -> int -> Lacaml_complex64.mat
create m n
val make : int -> int -> Lacaml_complex64.num_type -> Lacaml_complex64.mat
make m n x
val make0 : int -> int -> Lacaml_complex64.mat
make0 m n x
val of_array : Lacaml_complex64.num_type array array -> Lacaml_complex64.mat
of_array ar
val to_array : Lacaml_complex64.mat -> Lacaml_complex64.num_type array array
to_array mat
val of_col_vecs : Lacaml_complex64.vec array -> Lacaml_complex64.mat
of_col_vecs ar
val to_col_vecs : Lacaml_complex64.mat -> Lacaml_complex64.vec array
to_col_vecs mat
val as_vec : Lacaml_complex64.mat -> Lacaml_complex64.vec
as_vec mat
val init_rows :
int ->
int ->
(int -> int -> Lacaml_complex64.num_type) ->
Lacaml_complex64.mat
init_cols m n f
val init_cols :
int ->
int ->
(int -> int -> Lacaml_complex64.num_type) ->
Lacaml_complex64.mat
init_cols m n f
val create_mvec : int -> Lacaml_complex64.mat
create_mvec m
val make_mvec : int -> Lacaml_complex64.num_type -> Lacaml_complex64.mat
make_mvec m x
val mvec_of_array : Lacaml_complex64.num_type array -> Lacaml_complex64.mat
mvec_of_array ar
val mvec_to_array : Lacaml_complex64.mat -> Lacaml_complex64.num_type array
mvec_to_array mat
val from_col_vec : Lacaml_complex64.vec -> Lacaml_complex64.mat
from_col_vec v
val from_row_vec : Lacaml_complex64.vec -> Lacaml_complex64.mat
from_row_vec v
val empty : Lacaml_complex64.mat
empty
, the empty matrix.
val identity : int -> Lacaml_complex64.mat
identity n
val of_diag : Lacaml_complex64.vec -> Lacaml_complex64.mat
of_diag v
val dim1 : Lacaml_complex64.mat -> int
dim1 m
val dim2 : Lacaml_complex64.mat -> int
dim2 m
val col : Lacaml_complex64.mat -> int -> Lacaml_complex64.vec
col m n
val copy_row :
?vec:Lacaml_complex64.vec ->
Lacaml_complex64.mat ->
int ->
Lacaml_complex64.vec
copy_row ?vec mat int
val transpose_copy :
?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
?br:int ->
?bc:int ->
Lacaml_complex64.mat ->
unit
transpose_copy ?m ?n ?ar ?ac a ?br ?bc b
copy the transpose of (sub-)matrix a
into (sub-)matrix b
.
val transpose :
?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.mat
transpose ?m ?n ?ar ?ac aa
val detri :
?up:bool ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
unit
detri ?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.
val packed :
?up:bool ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.vec
packed ?up ?n ?ar ?ac a
val unpacked :
?up:bool ->
?n:int ->
Lacaml_complex64.vec ->
Lacaml_complex64.mat
unpacked ?up x
val add_const :
Lacaml_complex64.num_type ->
?m:int ->
?n:int ->
?br:int ->
?bc:int ->
?b:Lacaml_complex64.mat ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.mat
add_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
.
val sum :
?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.num_type
sum ?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_complex64.mat ->
Lacaml_complex64.num_type ->
unit
fill ?m ?n ?ar ?ac a x
fills the specified sub-matrix in a
with value x
.
val copy_diag : Lacaml_complex64.mat -> Lacaml_complex64.vec
copy_diag m
val trace : Lacaml_complex64.mat -> Lacaml_complex64.num_type
trace m
val scal :
?m:int ->
?n:int ->
Lacaml_complex64.num_type ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
unit
scal ?m ?n alpha ?ar ?ac a
BLAS scal
function for (sub-)matrices.
val scal_cols :
?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
?ofs:int ->
Lacaml_complex64.vec ->
unit
scal_cols ?m ?n ?ar ?ac a ?ofs alphas
column-wise scal
function for matrices.
val scal_rows :
?m:int ->
?n:int ->
?ofs:int ->
Lacaml_complex64.vec ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
unit
scal_rows ?m ?n ?ofs alphas ?ar ?ac a
row-wise scal
function for matrices.
val axpy :
?alpha:Lacaml_complex64.num_type ->
?m:int ->
?n:int ->
?xr:int ->
?xc:int ->
Lacaml_complex64.mat ->
?yr:int ->
?yc:int ->
Lacaml_complex64.mat ->
unit
axpy ?alpha ?m ?n ?xr ?xc x ?yr ?yc y
BLAS axpy
function for matrices.
val gemm_diag :
?n:int ->
?k:int ->
?beta:Lacaml_complex64.num_type ->
?ofsy:int ->
?y:Lacaml_complex64.vec ->
?transa:Lacaml_complex64.trans3 ->
?alpha:Lacaml_complex64.num_type ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
?transb:Lacaml_complex64.trans3 ->
?br:int ->
?bc:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.vec
gemm_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.
val syrk_diag :
?n:int ->
?k:int ->
?beta:Lacaml_complex64.num_type ->
?ofsy:int ->
?y:Lacaml_complex64.vec ->
?trans:Lacaml_common.trans2 ->
?alpha:Lacaml_complex64.num_type ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.vec
syrk_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.
val gemm_trace :
?n:int ->
?k:int ->
?transa:Lacaml_complex64.trans3 ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
?transb:Lacaml_complex64.trans3 ->
?br:int ->
?bc:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.num_type
gemm_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
.
val syrk_trace :
?n:int ->
?k:int ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.num_type
syrk_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.
val symm2_trace :
?n:int ->
?upa:bool ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
?upb:bool ->
?br:int ->
?bc:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.num_type
symm2_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
.
val map :
(Lacaml_complex64.num_type -> Lacaml_complex64.num_type) ->
?m:int ->
?n:int ->
?br:int ->
?bc:int ->
?b:Lacaml_complex64.mat ->
?ar:int ->
?ac:int ->
Lacaml_complex64.mat ->
Lacaml_complex64.mat
map f ?m ?n ?br ?bc ?b ?ar ?ac a
val fold_cols :
('a -> Lacaml_complex64.vec -> 'a) ->
?n:int ->
?ac:int ->
'a ->
Lacaml_complex64.mat ->
'a
fold_cols f ?n ?ac acc a