module type S =sig..end
module Coeff:Scalar.S
Type of coefficients.
type t
Type of matrices.
exception Dimension_error of string
Most of the functions in this module can raise this exception.
val of_list_list : Coeff.t list list -> tof_list_list l returns the matrix with lines corresponding to
the elements of the list l. All lists in l must have the
same length.
val to_list_list : t -> Coeff.t list list
val of_array_array : Coeff.t array array -> tof_array_array a returns the matrix with lines corresponding
to the elements of a. All arrays in a must have the same
size. A copy of the array is made internally.
val to_array_array : t -> Coeff.t array arrayThe returned array is a copy that can be freely modified by the user.
val zeros : int -> int -> tzeros n m builds a matrix of size n x m with all coefficients
equal to Coeff.of_int O. n and m must be non negative.
val eye : int -> teye n builds the identity matrix of size n (i.e., a square
matrix of size n with coefficients (i, j) equal to Coeff.of_int
O when i != j and Coeff.of_int 1 when i = j). n must be non
negative.
val kron : int -> int -> int -> tkron n i j builds the square matrix of size n with all coefficients
equal to zero (i.e., Coeff.of_int 0 except coefficients (i, j) which is
one (i.e., Coeff.of_int 1). n, i and j must satisfy 0 <= i < n and
0 <= j < n.
val kron_sym : int -> int -> int -> tkron_sym n i j builds the square matrix of size n with
all coefficients equal to zero (i.e., Coeff.of_int 0 except
coefficients (i, j) and (j, i) which are one (i.e., Coeff.of_int
1). n, i and j must satisfy 0 <= i < n and 0 <= j < n.
val block : t array array -> tblock a returns the block matrix corresponding to the array
a. For instance block [|[|a; b|]; [|c; d|]|] builds
the block matrix [a, b; c, d]. The array a must have a
positive size. All arrays in array a must have the same
positive size. Matrices dimensions must be consistent (for
instance, in the previous example, a and b must have the
same number of rows and a and c the same number of
columns).
val lift_block : t -> int -> int -> int -> int -> tlift_block m i j k l returns a matrix of size i x j with zeros
everywhere except starting from indices k x l where matrix m is
copied. The parameters must satisfy 0 <= k, 0 <= l, k + nb_lines
m <= i and l + nb_cols m <= j.
val transpose : t -> tMatrix transposition.
val minus : t -> tUnary minus.
val mult_scalar : Coeff.t -> t -> tmult_scalar s m multiplies matrix m by scalar s.
val add : t -> t -> tMatrix addition. Both matrices must have the same size.
val sub : t -> t -> tMatrix subtraction. Both matrices must have the same size.
val mult : t -> t -> tMatrix multiplication. First matrix must have as many columns as the second as rows.
val power : t -> int -> tpower m n computes m^n, n must be non negative.
val nb_lines : t -> int
val nb_cols : t -> int
val is_symmetric : t -> bool
val remove_0_row_cols : t -> tReturns the same matrix, without its rows and columns containing only 0.
val gauss_split : t -> int * t * tgauss_split m for a matrix m of size l x c returns (n, m1,
m2) where n is the rank of the input matrix (n <= l), m1
its row space, i.e., a matrix of size l' x c where l' <= l
characterizing the same space as m but with no linear
dependencies, and m2 a matrix of size l' x l mapping original
dimensions in m to the ones of m1 (m1 = m2 x m).
To use this operators, it's convenient to use local opens. For instance to write the matrix operations m1 * m2 + I_3x3:
let module M = Osdp.Matrix.Float in
M.(m1 * m2 + eye 3)
val (~:) : t -> tSame as transpose.
val (~-) : t -> tSame as minus.
val ( *. ) : Coeff.t -> t -> tSame as mult_scalar.
val (+) : t -> t -> tSame as add.
val (-) : t -> t -> tSame as sub.
val ( * ) : t -> t -> tSame as mult.
val ( ** ) : t -> int -> tSame as power.
val pp : Stdlib.Format.formatter -> t -> unit