module Mat:sig
..end
module type CNTMAT =sig
..end
module type DSCMAT =sig
..end
val cnt : ('m, 'n, Slap_misc.cnt) Slap_Z.mat -> ('m, 'n, 'cnt) Slap_Z.mat
val empty : (Slap_size.z, Slap_size.z, 'cnt) Slap_Z.mat
val create : 'm Slap_size.t -> 'n Slap_size.t -> ('m, 'n, 'cnt) Slap_Z.mat
create m n
m
-by-n
matrix (not initialized).val make : 'm Slap_size.t ->
'n Slap_size.t -> Slap_Z.num_type -> ('m, 'n, 'cnt) Slap_Z.mat
make m n x
m
-by-n
matrix initialized with x
.val make0 : 'm Slap_size.t -> 'n Slap_size.t -> ('m, 'n, 'cnt) Slap_Z.mat
make0 m n
m
-by-n
matrix initialized with 0
.val make1 : 'm Slap_size.t -> 'n Slap_size.t -> ('m, 'n, 'cnt) Slap_Z.mat
make1 m n
m
-by-n
matrix initialized with 1
.val identity : 'n Slap_size.t -> ('n, 'n, 'cnt) Slap_Z.mat
identity n
n
-by-n
identity matrix.val init : 'm Slap_size.t ->
'n Slap_size.t ->
(int -> int -> Slap_Z.num_type) -> ('m, 'n, 'cnt) Slap_Z.mat
init_cols
.val init_cols : 'm Slap_size.t ->
'n Slap_size.t ->
(int -> int -> Slap_Z.num_type) -> ('m, 'n, 'cnt) Slap_Z.mat
init_cols m n f
returns a fresh m
-by-n
matrix whose
the (i,j)
element is initialized by the result of calling f i j
.
The elements are passed column-wise.val init_rows : 'm Slap_size.t ->
'n Slap_size.t ->
(int -> int -> Slap_Z.num_type) -> ('m, 'n, 'cnt) Slap_Z.mat
init_rows m n f
returns a fresh m
-by-n
matrix whose
the (i,j)
element is initialized by the result of calling f i j
.
The elements are passed row-wise.val dim : ('m, 'n, 'cd) Slap_Z.mat -> 'm Slap_size.t * 'n Slap_size.t
dim a
is (dim1 a, dim2 a)
.val dim1 : ('m, 'n, 'cd) Slap_Z.mat -> 'm Slap_size.t
dim1 a
a
.val dim2 : ('m, 'n, 'cd) Slap_Z.mat -> 'n Slap_size.t
dim1 a
a
.val get_dyn : ('m, 'n, 'cd) Slap_Z.mat -> int -> int -> Slap_Z.num_type
get_dyn a i j
(i,j)
element of the matrix a
.val set_dyn : ('m, 'n, 'cd) Slap_Z.mat -> int -> int -> Slap_Z.num_type -> unit
set_dyn a i j x
assigns x
to the (i,j)
element of the matrix a
.val unsafe_get : ('m, 'n, 'cd) Slap_Z.mat -> int -> int -> Slap_Z.num_type
get_dyn
, but size checking is not always performed.val unsafe_set : ('m, 'n, 'cd) Slap_Z.mat -> int -> int -> Slap_Z.num_type -> unit
set_dyn
, but size checking is not always performed.val col_dyn : ('m, 'n, 'cd) Slap_Z.mat -> int -> ('m, 'cnt) Slap_Z.vec
col_dyn a i
i
-th column of the matrix a
. The data are shared.val row_dyn : ('m, 'n, 'cd) Slap_Z.mat -> int -> ('n, Slap_misc.dsc) Slap_Z.vec
row_dyn a i
i
-th row of the matrix a
. The data are shared.val copy_row_dyn : ('m, 'n, 'cd) Slap_Z.mat -> int -> ('n, 'cnt) Slap_Z.vec
copy_row_dyn a i
is Vec.copy (Mat.row_dyn a i)
.val diag : ('n, 'n, 'cd) Slap_Z.mat -> ('n, Slap_misc.dsc) Slap_Z.vec
diag a
a
. The data are shared.val diag_rect : ('m, 'n, 'cd) Slap_Z.mat ->
(('m, 'n) Slap_size.min, Slap_misc.dsc) Slap_Z.vec
diag_rect a
a
.
The data are shared.val copy_diag : ('n, 'n, 'cd) Slap_Z.mat -> ('n, 'cnt) Slap_Z.vec
copy_diag a
is Vec.copy (Mat.diag a)
.val copy_diag_rect : ('m, 'n, 'cd) Slap_Z.mat -> (('m, 'n) Slap_size.min, 'cnt) Slap_Z.vec
copy_diag_rect a
is Vec.copy (Mat.diag_rect a)
.val as_vec : ('m, 'n, Slap_misc.cnt) Slap_Z.mat ->
(('m, 'n) Slap_size.mul, 'cnt) Slap_Z.vec
as_vec a
val fill : ('m, 'n, 'cd) Slap_Z.mat -> Slap_Z.num_type -> unit
val copy : ?uplo:[ `L | `U ] ->
?b:('m, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat -> ('m, 'n, 'b_cd) Slap_Z.mat
copy ?uplo ?b a
copies the matrix a
into the matrix b
with
the LAPACK function lacpy
.uplo
is omitted, all elements in a
is copied.uplo
is `U
, the upper trapezoidal part of a
is copied.uplo
is `L
, the lower trapezoidal part of a
is copied.b
, which is overwritten.uplo
: default = all elements in a
is copied.b
: default = a fresh matrix.val of_col_vecs_dyn : 'm Slap_size.t ->
'n Slap_size.t ->
('m, Slap_misc.cnt) Slap_Z.vec array -> ('m, 'n, 'cnt) Slap_Z.mat
val to_array : ('m, 'n, 'cd) Slap_Z.mat -> Slap_Z.num_type array array
to_array a
a
.val of_array_dyn : 'm Slap_size.t ->
'n Slap_size.t -> Slap_Z.num_type array array -> ('m, 'n, 'cnt) Slap_Z.mat
Invalid_argument
the given array of arrays is not rectangular or
its size is not m
-by-n
.val of_array : Slap_Z.num_type array array -> (module Slap_Z.Mat.CNTMAT)
module M = (val of_array aa : CNTMAT)
Invalid_argument
the given array of arrays is not rectangular.M
containing the matrix M.value
that
has the type (M.m, M.n, 'cnt) mat
with a generative phantom types M.m
and M.n
as a package of an existential quantified sized type like
exists m, n. (m, n, 'cnt) mat
.module Of_array:
of_array
.
val unsafe_of_array : 'm Slap_size.t ->
'n Slap_size.t -> Slap_Z.num_type array array -> ('m, 'n, 'cnt) Slap_Z.mat
of_array_dyn
, but size checking is not always performed.val to_list : ('m, 'n, 'cd) Slap_Z.mat -> Slap_Z.num_type list list
to_list a
a
.val of_list_dyn : 'm Slap_size.t ->
'n Slap_size.t -> Slap_Z.num_type list list -> ('m, 'n, 'cnt) Slap_Z.mat
Invalid_argument
the given list of lists is not rectangular or
its size is not m
-by-n
.val of_list : Slap_Z.num_type list list -> (module Slap_Z.Mat.CNTMAT)
module M = (val of_list ll : CNTMAT)
Invalid_argument
the given list of lists is not rectangular.M
containing the matrix M.value
that
has the type (M.m, M.n, 'cnt) mat
with a generative phantom types M.m
and M.n
as a package of an existential quantified sized type like
exists m, n. (m, n, 'cnt) mat
.module Of_list:
of_list
.
val unsafe_of_list : 'm Slap_size.t ->
'n Slap_size.t -> Slap_Z.num_type list list -> ('m, 'n, 'cnt) Slap_Z.mat
of_list_dyn
, but size checking is not always performed.val to_bigarray : ('m, 'n, 'cd) Slap_Z.mat ->
(Slap_Z.num_type, Slap_Z.prec, Bigarray.fortran_layout) Bigarray.Array2.t
to_bigarray a
a
.val of_bigarray_dyn : ?share:bool ->
'm Slap_size.t ->
'n Slap_size.t ->
(Slap_Z.num_type, Slap_Z.prec, Bigarray.fortran_layout) Bigarray.Array2.t ->
('m, 'n, 'cnt) Slap_Z.mat
of_bigarray_dyn ?share m n ba
Invalid_argument
the size of the given big array is not equal
to m
-by-n
.ba
.share
: true
if data are shared. (default = false
)val of_bigarray : (Slap_Z.num_type, Slap_Z.prec, Bigarray.fortran_layout) Bigarray.Array2.t ->
(module Slap_Z.Mat.CNTMAT)
module M = (val of_bigarray ba : CNTMAT)
Invalid_argument
the given big array is not rectangular.M
containing the matrix M.value
that
has the type (M.m, M.n, 'cnt) mat
with a generative phantom types M.m
and M.n
as a package of an existential quantified sized type like
exists m, n. (m, n, 'cnt) mat
.module Of_bigarray:functor (
X
:
sig
val value :(Slap_Z.num_type, Slap_Z.prec, Bigarray.fortran_layout) Bigarray.Array2.t
end
) ->
CNTMAT
of_bigarray
.
val unsafe_of_bigarray : ?share:bool ->
'm Slap_size.t ->
'n Slap_size.t ->
(Slap_Z.num_type, Slap_Z.prec, Bigarray.fortran_layout) Bigarray.Array2.t ->
('m, 'n, 'cnt) Slap_Z.mat
of_bigarray_dyn
, but size checking is not always performed.val of_array_c : Slap_Z.num_type array array ->
(Slap_Z.num_type, Slap_Z.prec, 'cnt) Slap_mat.dyn
let Slap.Mat.MAT n = of_array_c arr
MAT
that has a matrix (initialized from the given
array of arrays) that has the existential quantified sized type
exists m, n. (n, 'num, 'prec, 'cnt_or_dsc) Mat.t
.
"c" of of_array_c
means a "c"onstructor of GADT. This function is
available in OCaml 4.00 or above.val of_list_c : Slap_Z.num_type list list ->
(Slap_Z.num_type, Slap_Z.prec, 'cnt) Slap_mat.dyn
let Slap.Mat.MAT n = of_list_c kind lst
MAT
that has a matrix (initialized from the given
list of lists) that has the existential quantified sized type
exists m, n. (n, 'num, 'prec, 'cnt_or_dsc) Mat.t
.
"c" of of_list_c
means a "c"onstructor of GADT. This function is available
in OCaml 4.00 or above.val of_bigarray_c : ?share:bool ->
(Slap_Z.num_type, Slap_Z.prec, Bigarray.fortran_layout) Bigarray.Array2.t ->
(Slap_Z.num_type, Slap_Z.prec, 'cnt) Slap_mat.dyn
let Slap.Mat.MAT n = of_bigarray_c ?share ba
MAT
that has a matrix (initialized from the given
big array) that has the existential quantified sized type
exists m, n. (n, 'num, 'prec, 'cnt_or_dsc) Mat.t
.
"c" of of_bigarray_c
means a "c"onstructor of GADT. This function is
available in OCaml 4.00 or above.share
: true
if data are shared. (default = false
)val map : (Slap_Z.num_type -> Slap_Z.num_type) ->
?b:('m, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat -> ('m, 'n, 'b_cd) Slap_Z.mat
val mapi : (int -> int -> Slap_Z.num_type -> Slap_Z.num_type) ->
?b:('m, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat -> ('m, 'n, 'b_cd) Slap_Z.mat
val fold_left : ('accum -> ('m, 'x_cd) Slap_Z.vec -> 'accum) ->
'accum -> ('m, 'n, 'a_cd) Slap_Z.mat -> 'accum
fold_left f init a
folds column vectors of matrix a
by f
in the order
left to right.val fold_lefti : (int -> 'accum -> ('m, 'x_cd) Slap_Z.vec -> 'accum) ->
'accum -> ('m, 'n, 'a_cd) Slap_Z.mat -> 'accum
fold_lefti f init a
folds column vectors of matrix a
by f
in the order
left to right.val fold_right : (('m, 'x_cd) Slap_Z.vec -> 'accum -> 'accum) ->
('m, 'n, 'a_cd) Slap_Z.mat -> 'accum -> 'accum
fold_right f a init
folds column vectors of matrix a
by f
in the
order right to left.val fold_righti : (int -> ('m, 'x_cd) Slap_Z.vec -> 'accum -> 'accum) ->
('m, 'n, 'a_cd) Slap_Z.mat -> 'accum -> 'accum
fold_righti f a init
folds column vectors of matrix a
by f
in the
order right to left.val fold_top : ('accum -> ('n, Slap_misc.dsc) Slap_Z.vec -> 'accum) ->
'accum -> ('m, 'n, 'a_cd) Slap_Z.mat -> 'accum
fold_top f init a
folds row vectors of matrix a
by f
in the order
top to bottom.val fold_topi : (int -> 'accum -> ('n, Slap_misc.dsc) Slap_Z.vec -> 'accum) ->
'accum -> ('m, 'n, 'a_cd) Slap_Z.mat -> 'accum
fold_topi f init a
folds row vectors of matrix a
by f
in the order
top to bottom.val fold_bottom : (('n, Slap_misc.dsc) Slap_Z.vec -> 'accum -> 'accum) ->
('m, 'n, 'a_cd) Slap_Z.mat -> 'accum -> 'accum
fold_bottom f a init
folds row vectors of matrix a
by f
in the
order bottom to top.val fold_bottomi : (int -> ('n, Slap_misc.dsc) Slap_Z.vec -> 'accum -> 'accum) ->
('m, 'n, 'a_cd) Slap_Z.mat -> 'accum -> 'accum
fold_bottomi f a init
folds row vectors of matrix a
by f
in the
order bottom to top.val replace_all : ('m, 'n, 'cd) Slap_Z.mat -> (Slap_Z.num_type -> Slap_Z.num_type) -> unit
replace_all a f
modifies the matrix a
in place
-- the (i,j)
-element aij
of a
will be set to f aij
.val replace_alli : ('m, 'n, 'cd) Slap_Z.mat ->
(int -> int -> Slap_Z.num_type -> Slap_Z.num_type) -> unit
replace_all a f
modifies the matrix a
in place
-- the (i,j)
-element aij
of a
will be set to f i j aij
.val transpose_copy : ?b:('n, 'm, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat -> ('n, 'm, 'b_cd) Slap_Z.mat
transpose_copy ?b a
copies the transpose of a
into b
.b
, which is overwritten.val detri : ?up:bool -> ('n, 'n, 'cd) Slap_Z.mat -> unit
detri ?up a
converts triangular matrix a
to a symmetric matrix, i.e.,
copies the upper or lower triangular part of a
into another part.up
: default = true
val packed : ?up:bool ->
?x:('n Slap_size.packed, Slap_misc.cnt) Slap_Z.vec ->
('n, 'n, 'cd) Slap_Z.mat -> ('n Slap_size.packed, 'cnt) Slap_Z.vec
packed ?up ?x a
transforms matrix a
into packed storage format.x
, which is overwritten.up
: default = true
up
= true
, then the upper triangular part of a
is packed;up
= false
, then the lower triangular part of a
is packed.val unpacked : ?up:bool ->
?fill_num:Slap_Z.num_type option ->
?a:('n, 'n, 'cd) Slap_Z.mat ->
('n Slap_size.packed, Slap_misc.cnt) Slap_Z.vec -> ('n, 'n, 'cd) Slap_Z.mat
unpacked ?up ?fill_num ?a x
generates an upper or lower triangular matrix
from packed-storage-format vector x
.a
, which is overwritten.up
: default = true
up
= true
, then the upper triangular matrix is generated;up
= false
, then the lower triangular matrix is generated.fill_num
: default = Some 0
fill_num
is None
, the elements in the generated matrix are not
initialized;fill_num
is Some c
, the elements in the generated matrix are
initialized by c
.val geband_dyn : 'kl Slap_size.t ->
'ku Slap_size.t ->
?b:(('m, 'n, 'kl, 'ku) Slap_size.geband, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat ->
(('m, 'n, 'kl, 'ku) Slap_size.geband, 'n, 'b_cd) Slap_Z.mat
geband_dyn kl ku ?b a
converts matrix a
into a matrix stored in band
storage.Invalid_arg
if kl >= dim1 a
or ku >= dim2 a
.b
, which is overwritten.val ungeband : 'm Slap_size.t ->
'kl Slap_size.t ->
'ku Slap_size.t ->
?fill_num:Slap_Z.num_type option ->
?a:('m, 'n, 'a_cd) Slap_Z.mat ->
(('m, 'n, 'kl, 'ku) Slap_size.geband, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat
ungeband m kl ku ?a b
converts matrix b
stored in band storage into
a matrix stored in the normal order.a
, which is overwritten.fill_num
: default = Some 0
fill_num
= None
, the elements in the generated matrix are not
initialized;fill_num
= Some c
, the elements in the generated matrix are
initialized by c
.val syband_dyn : 'kd Slap_size.t ->
?up:bool ->
?b:(('n, 'kd) Slap_size.syband, 'n, 'b_cd) Slap_Z.mat ->
('n, 'n, 'a_cd) Slap_Z.mat ->
(('n, 'kd) Slap_size.syband, 'n, 'b_cd) Slap_Z.mat
syband_dyn kd ?b a
converts matrix a
into a matrix stored in
symmetric or Hermitian band storage.Invalid_arg
if kd >= dim1 a
.b
, which is overwritten.up
: default = true
up
= true
, then the upper triangular part of a
is used;up
= false
, then the lower triangular part of a
is used.val unsyband : 'kd Slap_size.t ->
?up:bool ->
?fill_num:Slap_Z.num_type option ->
?a:('n, 'n, 'a_cd) Slap_Z.mat ->
(('n, 'kd) Slap_size.syband, 'n, 'b_cd) Slap_Z.mat ->
('n, 'n, 'a_cd) Slap_Z.mat
unsyband kd ?a b
converts matrix b
stored in symmetric or Hermitian
band storage into a matrix stored in the normal order.a
, which is overwritten.up
: default = true
up
= true
, then b
is treated as the upper triangular part of
symmetric or Hermitian matrix a
;up
= false
, then b
is treated as the lower triangular part of
symmetric or Hermitian matrix a
;fill_num
: default = Some 0
fill_num
= None
, the elements in the generated matrix are not
initialized;fill_num
= Some c
, the elements in the generated matrix are
initialized by c
.val luband_dyn : 'kl Slap_size.t ->
'ku Slap_size.t ->
?ab:(('m, 'n, 'kl, 'ku) Slap_size.luband, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat ->
(('m, 'n, 'kl, 'ku) Slap_size.luband, 'n, 'b_cd) Slap_Z.mat
luband_dyn kl ku ?ab a
converts matrix a
into a matrix stored in band
storage for LU factorization.Invalid_arg
if kl >= dim1 a
or ku >= dim2 a
.ab
, which is overwritten.val unluband : 'm Slap_size.t ->
'kl Slap_size.t ->
'ku Slap_size.t ->
?fill_num:Slap_Z.num_type option ->
?a:('m, 'n, 'a_cd) Slap_Z.mat ->
(('m, 'n, 'kl, 'ku) Slap_size.luband, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat
unluband m kl ku ?a ab
converts matrix ab
stored in band storage for LU
factorization into a matrix stored in the normal order.a
, which is overwritten.fill_num
: default = Some 0
fill_num
= None
, the elements in the generated matrix are not
initialized;fill_num
= Some c
, the elements in the generated matrix are
initialized by c
.val add_const : Slap_Z.num_type ->
?b:('m, 'n, 'b_cd) Slap_Z.mat ->
('m, 'n, 'a_cd) Slap_Z.mat -> ('m, 'n, 'b_cd) Slap_Z.mat
add_const c ?b a
adds constant value c
to all elements in a
.b
, which is overwritten.val sum : ('m, 'n, 'cd) Slap_Z.mat -> Slap_Z.num_type
sum a
returns the sum of all elements in a
.val trace : ('m, 'n, 'cd) Slap_Z.mat -> Slap_Z.num_type
trace a
a
.val scal : Slap_Z.num_type -> ('m, 'n, 'cd) Slap_Z.mat -> unit
scal alpha a
computes a := alpha * a
with the scalar value alpha
and
the matrix a
.val scal_cols : ('m, 'n, 'cd) Slap_Z.mat -> ('n, Slap_misc.cnt) Slap_Z.vec -> unit
scal
function for matrices.val scal_rows : ('m, Slap_misc.cnt) Slap_Z.vec -> ('m, 'n, 'cd) Slap_Z.mat -> unit
scal
function for matrices.val axpy : ?alpha:Slap_Z.num_type ->
('m, 'n, 'x_cd) Slap_Z.mat -> ('m, 'n, 'y_cd) Slap_Z.mat -> unit
axpy ?alpha x y
computes y := alpha * x + y
.val gemm_diag : ?beta:Slap_Z.num_type ->
?y:('n, Slap_misc.cnt) Slap_Z.vec ->
transa:('a_n * 'a_k, 'n * 'k, [< `C | `N | `T ]) Slap_Z.trans3 ->
?alpha:Slap_Z.num_type ->
('a_n, 'a_k, 'a_cd) Slap_Z.mat ->
transb:('b_k * 'b_n, 'k * 'n, [< `C | `N | `T ]) Slap_Z.trans3 ->
('b_k, 'b_n, 'b_cd) Slap_Z.mat -> ('n, 'cnt) Slap_Z.vec
gemm_diag ?beta ?y ~transa ?alpha a ~transb b
executes
y := DIAG(alpha * OP(a) * OP(b)) + beta * y
where
DIAG(x)
is the vector of the diagonal elements in matrix x
, and
OP(x)
is one of OP(x)
= x
, OP(x)
= x^T
, or OP(x)
= x^H
(the conjugate transpose of x
).y
, which is overwritten.beta
: default = 0.0
transa
: the transpose flag for a
:Slap_common.normal
, then OP(a)
= a
;Slap_common.trans
, then OP(a)
= a^T
;Slap_common.conjtr
, then OP(a)
= a^H
.alpha
: default = 1.0
transb
: the transpose flag for b
:Slap_common.normal
, then OP(b)
= b
;Slap_common.trans
, then OP(b)
= b^T
;Slap_common.conjtr
, then OP(b)
= b^H
.val syrk_diag : ?beta:Slap_Z.num_type ->
?y:('n, Slap_misc.cnt) Slap_Z.vec ->
trans:('a_n * 'a_k, 'n * 'k, [< `N | `T ]) Slap_common.trans2 ->
?alpha:Slap_Z.num_type ->
('a_n, 'a_k, 'a_cd) Slap_Z.mat -> ('n, 'cnt) Slap_Z.vec
syrk_diag ?beta ?y ~transa ?alpha a
executes
y := alpha * DIAG(a * a^T) + beta * y
(if trans
= Slap_common.normal
) ory := alpha * DIAG(a^T * a) + beta * y
(if trans
= Slap_common.trans
)DIAG(x)
is the vector of the diagonal elements in matrix x
.y
, which is overwritten.beta
: default = 0.0
alpha
: default = 1.0
val gemm_trace : transa:('a_n * 'a_k, 'n * 'k, [< `C | `N | `T ]) Slap_Z.trans3 ->
('a_n, 'a_k, 'a_cd) Slap_Z.mat ->
transb:('b_k * 'b_n, 'k * 'n, [< `C | `N | `T ]) Slap_Z.trans3 ->
('b_k, 'b_n, 'b_cd) Slap_Z.mat -> Slap_Z.num_type
gemm_trace ~transa a ~transb b
OP(a) * OP(b)
.transa
: the transpose flag for a
:Slap_common.normal
, then OP(a)
= a
;Slap_common.trans
, then OP(a)
= a^T
;Slap_common.conjtr
, then OP(a)
= a^H
.transb
: the transpose flag for b
:Slap_common.normal
, then OP(b)
= b
;Slap_common.trans
, then OP(b)
= b^T
;Slap_common.conjtr
, then OP(b)
= b^H
.val syrk_trace : ('n, 'k, 'cd) Slap_Z.mat -> Slap_Z.num_type
syrk_trace a
computes the trace of a * a^T
or a^T * a
.val symm2_trace : ?upa:bool ->
('n, 'n, 'a_cd) Slap_Z.mat ->
?upb:bool -> ('n, 'n, 'b_cd) Slap_Z.mat -> Slap_Z.num_type
symm2_trace ?upa a ?upb b
computes the trace of a * b
with symmetric
matrices a
and b
.upa
: default = true
upa
= true
, then the upper triangular part of a
is used;upa
= false
, then the lower triangular part of a
is used.upb
: default = true
upb
= true
, then the upper triangular part of b
is used;upb
= false
, then the lower triangular part of b
is used.val submat_dyn : 'm Slap_size.t ->
'n Slap_size.t ->
?ar:int ->
?ac:int -> ('a, 'b, 'cd) Slap_Z.mat -> ('m, 'n, Slap_misc.dsc) Slap_Z.mat
submat_dyn m n ?ar ?ac a
m
-by-n
submatrix of the matrix a
.
The (i,j)
element of the returned matrix refers the (ar+i-1,ac+j-1)
element of a
. The data are shared.ar
: default = 1ac
: default = 1val random : ?rnd_state:Random.State.t ->
?re_from:float ->
?re_range:float ->
?im_from:float ->
?im_range:float ->
'm Slap_size.t -> 'n Slap_size.t -> ('m, 'n, 'cnt) Slap_Z.mat
random ?rnd_state ?from ?range m n
creates a m
-by-n
matrix randomly
initialized with the uniform distribution between re_from
/im_from
and
re_from+re_range
/im_from+im_range
for real and imaginary parts,
respectively.rnd_state
: default = Random.get_state ()
.re_from
: default = -1.0
.re_range
: default = 2.0
.im_from
: default = -1.0
.im_range
: default = 2.0
.