14.10 Class LinAlg¶
- mosek.LinAlg¶
BLAS/LAPACK linear algebra routines.
- Static members:
LinAlg.axpy – Computes vector addition and multiplication by a scalar.
LinAlg.dot – Computes the inner product of two vectors.
LinAlg.gemm – Performs a dense matrix multiplication.
LinAlg.gemv – Computes dense matrix times a dense vector product.
LinAlg.potrf – Computes a Cholesky factorization of a dense matrix.
LinAlg.syeig – Computes all eigenvalues of a symmetric dense matrix.
LinAlg.syevd – Computes all the eigenvalues and eigenvectors of a symmetric dense matrix, and thus its eigenvalue decomposition.
LinAlg.syrk – Performs a rank-k update of a symmetric matrix.
- LinAlg.axpy¶
LinAlg.axpy(int n, float alpha, float[] x, float[] y)
Adds
to , i.e. performs the updateNote that the result is stored overwriting
. It must not overlap with the other input arrays.- Parameters:
n
(int
) – Length of the vectors.alpha
(float
) – The scalar that multiplies .x
(float
[]) – The vector.y
(float
[]) – The vector.
- LinAlg.dot¶
LinAlg.dot(int n, float[] x, float[] y) -> float
Computes the inner product of two vectors
of length , i.eNote that if
, then the result of the operation is 0.- Parameters:
n
(int
) – Length of the vectors.x
(float
[]) – The vector.y
(float
[]) – The vector.
- Return:
(
float
)
- LinAlg.gemm¶
LinAlg.gemm(mosek.transpose transa, mosek.transpose transb, int m, int n, int k, float alpha, float[] a, float[] b, float beta, float[] c)
Performs a matrix multiplication plus addition of dense matrices. Given
, and of compatible dimensions, this function computeswhere
are two scalar values. The function denotes if transX isNO
, or if set toYES
. The matrix has rows and columns, and the other matrices must have compatible dimensions.The result of this operation is stored in
. It must not overlap with the other input arrays.- Parameters:
transa
(transpose
) – Indicates if should be transposed. See the Optimizer API documentation for the definition of these constants.transb
(transpose
) – Indicates if should be transposed. See the Optimizer API documentation for the definition of these constants.m
(int
) – Indicates the number of rows of matrix .n
(int
) – Indicates the number of columns of matrix .k
(int
) – Specifies the common dimension along which and are multiplied. For example, if neither nor are transposed, then this is the number of columns in and also the number of rows in .alpha
(float
) – A scalar value multiplying the result of the matrix multiplication.a
(float
[]) – The pointer to the array storing matrix in a column-major format.b
(float
[]) – The pointer to the array storing matrix in a column-major format.beta
(float
) – A scalar value that multiplies .c
(float
[]) – The pointer to the array storing matrix in a column-major format.
- LinAlg.gemv¶
LinAlg.gemv(mosek.transpose trans, int m, int n, float alpha, float[] a, float[] x, float beta, float[] y)
Computes the multiplication of a scaled dense matrix times a dense vector, plus a scaled dense vector. Precisely, if
trans
isNO
then the update isand if
trans
isYES
thenwhere
are scalar values and is a matrix with rows and columns.Note that the result is stored overwriting
. It must not overlap with the other input arrays.- Parameters:
trans
(transpose
) – Indicates if should be transposed. See the Optimizer API documentation for the definition of these constants.m
(int
) – Specifies the number of rows of the matrix .n
(int
) – Specifies the number of columns of the matrix .alpha
(float
) – A scalar value multiplying the matrix .a
(float
[]) – A pointer to the array storing matrix in a column-major format.x
(float
[]) – A pointer to the array storing the vector .beta
(float
) – A scalar value multiplying the vector .y
(float
[]) – A pointer to the array storing the vector .
- LinAlg.potrf¶
LinAlg.potrf(mosek.uplo uplo, int n, float[] a)
Computes a Cholesky factorization of a real symmetric positive definite dense matrix.
- Parameters:
uplo
(uplo
) – Indicates whether the upper or lower triangular part of the matrix is used. See the Optimizer API documentation for the definition of these constants.n
(int
) – Specifies the dimension of the symmetric matrix.a
(float
[]) – A symmetric matrix stored in column-major order. Only the lower or the upper triangular part is used, accordingly with theuplo
argument. It will contain the result on exit.
- LinAlg.syeig¶
LinAlg.syeig(mosek.uplo uplo, int n, float[] a, float[] w)
Computes all eigenvalues of a real symmetric matrix
. Given a matrix it returns a vector containing the eigenvalues of .- Parameters:
uplo
(uplo
) – Indicates whether the upper or lower triangular part of the matrix is used. See the Optimizer API documentation for the definition of these constants.n
(int
) – Specifies the dimension of the symmetric matrix.a
(float
[]) – A symmetric matrix stored in column-major order. Only the lower or the upper triangular part is used, accordingly with theuplo
argument. It will contain the result on exit.w
(float
[]) – Array of length at leastn
containing the eigenvalues of .
- LinAlg.syevd¶
LinAlg.syevd(mosek.uplo uplo, int n, float[] a, float[] w)
Computes all the eigenvalues and eigenvectors a real symmetric matrix. Given the input matrix
, this function returns a vector containing the eigenvalues of and it also computes the eigenvectors of . Therefore, this function computes the eigenvalue decomposition of aswhere
and contains the eigenvectors of .Note that the matrix
overwrites the input data .- Parameters:
uplo
(uplo
) – Indicates whether the upper or lower triangular part of the matrix is used. See the Optimizer API documentation for the definition of these constants.n
(int
) – Specifies the dimension of the symmetric matrix.a
(float
[]) – A symmetric matrix stored in column-major order. Only the lower or the upper triangular part is used, accordingly with theuplo
argument. It will contain the result on exit.w
(float
[]) – Array of length at leastn
containing the eigenvalues of .
- LinAlg.syrk¶
LinAlg.syrk(mosek.uplo uplo, mosek.transpose trans, int n, int k, float alpha, float[] a, float beta, float[] c)
Performs a symmetric rank-
update for a symmetric matrix.Given a symmetric matrix
, two scalars and a matrix of rank , it computes eitherwhen
trans
is set toNO
and , orwhen
trans
is set toYES
and .Only the part of
indicated byuplo
is used and only that part is updated with the result. It must not overlap with the other input arrays.- Parameters:
uplo
(uplo
) – Indicates whether the upper or lower triangular part of is used. See the Optimizer API documentation for the definition of these constants.trans
(transpose
) – Indicates if should be transposed. See the Optimizer API documentation for the definition of these constants.n
(int
) – Specifies the order of .k
(int
) – Indicates the number of rows or columns of , depending on whether or not it is transposed, and its rank.alpha
(float
) – A scalar value multiplying the result of the matrix multiplication.a
(float
[]) – The pointer to the array storing matrix in a column-major format.beta
(float
) – A scalar value that multiplies .c
(float
[]) – The pointer to the array storing matrix in a column-major format.