package osdp
Module Matrix.QSource
Matrix with Q.t coefficients from the library Zarith.
Type of matrices.
Most of the functions in this module can raise this exception.
Conversion functions.
of_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.
of_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.
The returned array is a copy that can be freely modified by the user.
Construction functions.
zeros 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.
eye 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.
kron 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.
kron_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.
block 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).
lift_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.
Matrix operations.
Matrix multiplication. First matrix must have as many columns as the second as rows.
Various operations.
Returns the same matrix, without its rows and columns containing only 0.
gauss_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).
Prefix and infix operators.
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)Same as mult_scalar.