The level 2 functions implement matrix-vector products and rank-1 and rank-2 matrix updates. Different types of matrix structure can be exploited using the conventions of section 3.1.
gemv(A, x, y[, trans=’N’[, alpha=1.0[, beta=0.0]]])
Matrix-vector product with a general matrix:
The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha and beta are only allowed if A is complex.
symv(A, x, y[, uplo=’L’[, alpha=1.0[, beta=0.0]]])
Matrix-vector product with a real symmetric matrix:
where A is a real symmetric matrix. The arguments A, x and y must have type ’d’ and alpha and beta must be real.
hemv(A, x, y[, uplo=’L’[, alpha=1.0[, beta=0.0]]])
Matrix-vector product with a real symmetric or complex Hermitian matrix:
where A is real symmetric or complex Hermitian. The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha and beta are only allowed if A is complex.
trmv(A, x[, uplo=’L’[, trans=’N’[, diag=’N’]]])
Matrix-vector product with a triangular matrix:
where A is square and triangular. The arguments A and x must have the same type (’d’ or ’z’).
trsv(A, x[, uplo=’L’[, trans=’N’[, diag=’N’]]])
Solution of a nonsingular triangular set of linear equations:
where A is square and triangular with nonzero diagonal elements. The arguments A and x must have the same type (’d’ or ’z’).
gbmv(A, m, kl, x, y[, trans=’N’ [, alpha=1.0[, beta=0.0]]])
Matrix-vector product with a general band matrix:
where A is a rectangular band matrix with m rows and kl subdiagonals. The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha and beta are only allowed if A is complex.
sbmv(A, x, y[, uplo=’L’[, alpha=1.0[, beta=0.0]]])
Matrix-vector product with a real symmetric band matrix:
where A is a real symmetric band matrix. The arguments A, x and y must have type ’d’ and alpha and beta must be real.
hbmv(A, x, y[, uplo=’L’[, alpha=1.0[, beta=0.0]]])
Matrix-vector product with a real symmetric or complex Hermitian band matrix:
where A is a real symmetric or complex Hermitian band matrix. The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha and beta are only allowed if A is complex.
tbmv(A, x[, uplo=’L’[, trans[, diag]]])
Matrix-vector product with a triangular band matrix:
The arguments A and x must have the same type (’d’ or ’z’).
tbsv(A, x[, uplo=’L’[, trans[, diag]]])
Solution of a triangular banded set of linear equations:
where A is a triangular band matrix of with nonzero diagonal elements. The arguments A and x must have the same type (’d’ or ’z’).
ger(x, y, A[, alpha=1.0])
General rank-1 update:
where A is a general matrix. The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha are only allowed if A is complex.
geru(x, y, A[, alpha=1.0])
General rank-1 update:
where A is a general matrix. The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha are only allowed if A is complex.
syr(x, A[, uplo=’L’[, alpha=1.0]])
Symmetric rank-1 update:
where A is a real symmetric matrix. The arguments A and x must have type ’d’. alpha must be a real number.
her(x, A[, uplo=’L’[, alpha=1.0]])
Hermitian rank-1 update:
where A is a real symmetric or complex Hermitian matrix. The arguments A and x must have the same type (’d’ or ’z’). alpha must be a real number.
syr2(x, y, A[, uplo=’L’[, alpha=1.0]])
Symmetric rank-2 update:
where A is a real symmetric matrix. The arguments A, x and y must have type ’d’. alpha must be real.
her2(x, y, A[, uplo=’L’[, alpha=1.0]])
Symmetric rank-2 update:
where A is a a real symmetric or complex Hermitian matrix. The arguments A, x and y must have the same type (’d’ or ’z’). Complex values of alpha are only allowed if A is complex.
As an example, the following code multiplies the tridiagonal matrix
with the vector x = (1,-1,2,-2).
>>> from cvxopt.base import matrix
>>> from cvxopt.blas import gbmv >>> A = matrix([[0., 1., 2.], [6., -4., -3.], [3., -1., 0.], [1., 0., 0.]]) >>> x = matrix([1., -1., 2., -2.]) >>> y = matrix(0., (3,1)) >>> gbmv(A, 3, 1, x, y) >>> print y [-5.00e+00] [ 1.20e+01] [-1.00e+00] |
The following example illustrates the use of tbsv().
>>> from cvxopt.base import matrix
>>> from cvxopt.blas import tbsv >>> A = matrix([-6., 5., -1., 2.], (1,4)) >>> x = matrix(1.0, (4,1)) >>> tbsv(A, x) # x := diag(A)^{-1}*x >>> print x [-1.67e-01] [ 2.00e-01] [-1.00e+00] [ 5.00e-01] |