Page
Library
Module
Module type
Parameter
Class
Class type
Source
C.Mattype t = matval random :
?rnd_state:Random.State.t ->
?re_from:float ->
?re_range:float ->
?im_from:float ->
?im_range:float ->
int ->
int ->
matrandom ?rnd_state ?re_from ?re_range ?im_from ?im_range m n
val create : int -> int -> matcreate m n
val make0 : int -> int -> matmake0 m n x
val create_mvec : int -> matcreate_mvec m
val empty : matempty, the empty matrix.
val identity : int -> matidentity n
of_diag ?n ?br ?bc ?b ?ofsx ?incx x
val dim1 : mat -> intdim1 m
val dim2 : mat -> intdim2 m
val has_zero_dim : mat -> boolhas_zero_dim mat checks whether matrix mat has a dimension of size zero. In this case it cannot contain data.
val swap :
?uplo:[ `U | `L ] ->
?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
mat ->
?br:int ->
?bc:int ->
mat ->
unitswap ?m ?n ?ar ?ac a ?br ?bc b swaps the contents of (sub-matrices) a and b.
val transpose_copy : unoptranspose_copy ?m ?n ?br ?bc ?b ?ar ?ac a
val detri : ?up:bool -> ?n:int -> ?ar:int -> ?ac:int -> 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.
fill ?m ?n ?ar ?ac a x fills the specified sub-matrix in a with value x.
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.
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 neg : unopneg ?m ?n ?br ?bc ?b ?ar ?ac a computes the negative of the elements in the m by n (sub-)matrix of the matrix a starting in row ar and column ac. If b is given, the result will be stored in there using offsets br and bc, otherwise a fresh matrix will be used. The resulting matrix is returned.
val reci : unopreci ?m ?n ?br ?bc ?b ?ar ?ac a computes the reciprocal of the elements in the m by n (sub-)matrix of the matrix a starting in row ar and column ac. If b is given, the result will be stored in there using offsets br and bc, otherwise a fresh matrix will be used. The resulting matrix is returned.
copy_diag ?n ?ofsy ?incy ?y ?ar ?ac a
scal ?m ?n alpha ?ar ?ac a BLAS scal function for (sub-)matrices.
scal_cols ?m ?n ?ar ?ac a ?ofs alphas column-wise scal function for matrices.
scal_rows ?m ?n ?ofs alphas ?ar ?ac a row-wise scal function for matrices.
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 syrk_diag :
?n:int ->
?k:int ->
?beta:Complex.t ->
?ofsy:int ->
?y:vec ->
?trans:[ `N | `T ] ->
?alpha:Complex.t ->
?ar:int ->
?ac:int ->
mat ->
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.
val add : binopadd ?m ?n ?cr ?cc ?c ?ar ?ac a ?br ?bc b computes the sum of the m by n sub-matrix of the matrix a starting in row ar and column ac with the corresponding sub-matrix of the matrix b starting in row br and column bc. If c is given, the result will be stored in there starting in row cr and column cc, otherwise a fresh matrix will be used. The resulting matrix is returned.
val sub : binopsub ?m ?n ?cr ?cc ?c ?ar ?ac a ?br ?bc b computes the difference of the m by n sub-matrix of the matrix a starting in row ar and column ac with the corresponding sub-matrix of the matrix b starting in row br and column bc. If c is given, the result will be stored in there starting in row cr and column cc, otherwise a fresh matrix will be used. The resulting matrix is returned.
val mul : binopmul ?m ?n ?cr ?cc ?c ?ar ?ac a ?br ?bc b computes the element-wise product of the m by n sub-matrix of the matrix a starting in row ar and column ac with the corresponding sub-matrix of the matrix b starting in row br and column bc. If c is given, the result will be stored in there starting in row cr and column cc, otherwise a fresh matrix will be used. The resulting matrix is returned.
NOTE: please do not confuse this function with matrix multiplication! The LAPACK-function for matrix multiplication is called gemm, e.g. Lacaml.D.gemm.
val div : binopdiv ?m ?n ?cr ?cc ?c ?ar ?ac a ?br ?bc b computes the division of the m by n sub-matrix of the matrix a starting in row ar and column ac with the corresponding sub-matrix of the matrix b starting in row br and column bc. If c is given, the result will be stored in there starting in row cr and column cc, otherwise a fresh matrix will be used. The resulting matrix is returned.
val axpy :
?alpha:Complex.t ->
?m:int ->
?n:int ->
?xr:int ->
?xc:int ->
mat ->
?yr:int ->
?yc:int ->
mat ->
unitaxpy ?alpha ?m ?n ?xr ?xc x ?yr ?yc y BLAS axpy function for matrices.
val gemm_diag :
?n:int ->
?k:int ->
?beta:Complex.t ->
?ofsy:int ->
?y:vec ->
?transa:trans3 ->
?alpha:Complex.t ->
?ar:int ->
?ac:int ->
mat ->
?transb:trans3 ->
?br:int ->
?bc:int ->
mat ->
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.
val gemm_trace :
?n:int ->
?k:int ->
?transa:trans3 ->
?ar:int ->
?ac:int ->
mat ->
?transb:trans3 ->
?br:int ->
?bc:int ->
mat ->
Complex.tgemm_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). When transposing a, this yields the so-called Frobenius product of a and b. n is the number of rows (columns) to consider in a and the number of columns (rows) in b. k is the inner dimension to use for the product.
val symm2_trace :
?n:int ->
?upa:bool ->
?ar:int ->
?ac:int ->
mat ->
?upb:bool ->
?br:int ->
?bc:int ->
mat ->
Complex.tsymm2_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 ssqr_diff :
?m:int ->
?n:int ->
?ar:int ->
?ac:int ->
mat ->
?br:int ->
?bc:int ->
mat ->
Complex.tssqr_diff ?m ?n ?ar ?ac a ?br ?bc b