![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
Contains prototypes for BLAS level 1, 2, 3 and Lapack routines. More...
#include "gurls++/blas_lapack.hpp"
Go to the source code of this file.
Classes | |
class | gurls::BlasUtils |
BlasUtils is a convenience class to interface with Blas. More... | |
Namespaces | |
namespace | gurls |
The main namespace of GURLS++. | |
Enumerations | |
enum | gurls::CBLAS_DIAG { CblasNonUnit = 5, CblasUnit = 6 } |
Diagonal options (unit, non unit) | |
enum | gurls::CBLAS_ORDER { CblasRowMajor = 9, CblasColMajor = 10 } |
Matrix Order (row major or column major) | |
enum | gurls::CBLAS_SIDE { CblasLeft = 7, CblasRight = 8 } |
Side options (left, right) | |
enum | gurls::CBLAS_TRANSPOSE { CblasNoTrans = 0, CblasTrans = 1, CblasConjTrans = 2 } |
Transposition options (no transpose, transpose, conjugate transpose) | |
enum | gurls::CBLAS_UPLO { CblasUpper = 3, CblasLower = 4 } |
Upper/lower options (upper, lower) | |
Functions | |
void | daxpy_ (int *n, double *alpha, double *x, int *incx, double *y, int *incy) |
Prototype for Blas DAXPY. | |
void | dcopy_ (int *n, double *x, int *incx, double *y, int *incy) |
Prototype for Blas DCOPY. | |
double | ddot_ (int *n, double *x, int *incx, double *y, int *incy) |
Prototype for Blas DDOT. | |
int | dgeev_ (char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wi, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info) |
Prototype for Lapack DGEEV. | |
int | dgelss_ (int *m, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *s, double *rcond, int *rank, double *work, int *lwork, int *info) |
Prototype for Lapack DGELSS. | |
void | dgemm_ (char *transa, char *transb, int *m, int *n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc) |
Prototype for Blas DGEMM. | |
void | dgemv_ (char *trans, int *m, int *n, double *alpha, double *a, int *lda, double *x, int *incx, double *beta, double *y, int *incy) |
Prototype for Blas DGEMV. | |
void | dgeqp3_ (int *m, int *n, double *A, int *lda, int *jpvt, double *tau, double *work, int *lwork, int *info) |
Prototype for Lapack DGEQP3. | |
int | dgesvd_ (char *jobu, char *jobvt, int *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info) |
Prototype for Lapack DGESVD. | |
double | dnrm2_ (int *n, double *x, int *incx) |
Prototype for Blas DNRM2. | |
void | dorgqr_ (int *m, int *n, int *k, double *a, int *lda, double *tau, double *work, int *lwork, int *info) |
Prototype for Lapack DORGQR. | |
int | dpotrf_ (char *UPLO, int *n, double *a, int *lda, int *info) |
Prototype for Lapack DPOTRF. | |
void | dscal_ (int *n, double *a, double *x, int *incx) |
Prototype for Blas DSCAL. | |
void | dswap_ (int *n, double *sx, int *incx, double *sy, int *incy) |
Prototype for Blas DSWAP. | |
int | dsyev_ (char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *info) |
Prototype for Lapack DSYEV. | |
void | dtrsm_ (char *side, char *uplo, char *transa, char *diag, int *m, int *n, double *alpha, double *a, int *lda, double *b, int *ldb) |
Prototype for Blas DTRSM. | |
void | saxpy_ (int *n, float *alpha, float *x, int *incx, float *y, int *incy) |
Prototype for Blas SAXPY. | |
void | scopy_ (int *n, float *x, int *incx, float *y, int *incy) |
Prototype for Blas SCOPY. | |
float | sdot_ (int *n, float *x, int *incx, float *y, int *incy) |
Prototype for Blas SDOT. | |
int | sgeev_ (char *jobvl, char *jobvr, int *n, float *a, int *lda, float *wr, float *wi, float *vl, int *ldvl, float *vr, int *ldvr, float *work, int *lwork, int *info) |
Prototype for Lapack SGEEV. | |
int | sgelss_ (int *m, int *n, int *nrhs, float *a, int *lda, float *b, int *ldb, float *s, float *rcond, int *rank, float *work, int *lwork, int *info) |
Prototype for Lapack SGELSS. | |
void | sgemm_ (char *transa, char *transb, int *m, int *n, int *k, float *alpha, float *a, int *lda, float *b, int *ldb, float *beta, float *c, int *ldc) |
Prototype for Blas SGEMM. | |
void | sgemv_ (char *trans, int *m, int *n, float *alpha, float *a, int *lda, float *x, int *incx, float *beta, float *y, int *incy) |
Prototype for Blas SGEMV. | |
void | sgeqp3_ (int *m, int *n, float *A, int *lda, int *jpvt, float *tau, float *work, int *lwork, int *info) |
Prototype for Lapack SGEQP3. | |
int | sgesvd_ (char *jobu, char *jobvt, int *m, int *n, float *a, int *lda, float *s, float *u, int *ldu, float *vt, int *ldvt, float *work, int *lwork, int *info) |
Prototype for Lapack SGESVD. | |
int | sgetrf_ (int *m, int *n, float *a, int *lda, int *ipiv, int *info) |
Prototype for Lapack SGETRF. | |
int | sgetri_ (int *n, float *a, int *lda, int *ipiv, float *work, int *lwork, int *info) |
Prototype for Lapack SGETRI. | |
float | snrm2_ (int *n, float *x, int *incx) |
Prototype for Blas SNRM2. | |
void | sorgqr_ (int *m, int *n, int *k, float *a, int *lda, float *tau, float *work, int *lwork, int *info) |
Prototype for Lapack SORGQR. | |
int | spotrf_ (char *UPLO, int *n, float *a, int *lda, int *info) |
Prototype for Lapack SPOTRF. | |
void | sscal_ (int *n, float *a, float *x, int *incx) |
Prototype for Blas SSCAL. | |
void | sswap_ (int *n, float *sx, int *incx, float *sy, int *incy) |
Prototype for Blas SSWAP. | |
int | ssyev_ (char *jobz, char *uplo, int *n, float *a, int *lda, float *w, float *work, int *lwork, int *info) |
Prototype for Lapack SSYEV. | |
void | strsm_ (char *side, char *uplo, char *transa, char *diag, int *m, int *n, float *alpha, float *a, int *lda, float *b, int *ldb) |
Prototype for Blas STRSM. |
Definition in file blas_lapack.h.
void daxpy_ | ( | int * | n, |
double * | alpha, | ||
double * | x, | ||
int * | incx, | ||
double * | y, | ||
int * | incy | ||
) |
Constant times a vector plus a vector
void dcopy_ | ( | int * | n, |
double * | x, | ||
int * | incx, | ||
double * | y, | ||
int * | incy | ||
) |
Copies a vector x to a vector y
double ddot_ | ( | int * | n, |
double * | x, | ||
int * | incx, | ||
double * | y, | ||
int * | incy | ||
) |
Dot product of two double precision vectors
int dgeev_ | ( | char * | jobvl, |
char * | jobvr, | ||
int * | n, | ||
double * | a, | ||
int * | lda, | ||
double * | wr, | ||
double * | wi, | ||
double * | vl, | ||
int * | ldvl, | ||
double * | vr, | ||
int * | ldvr, | ||
double * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes for an N-by-N real nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or right eigenvectors. The right eigenvector v(j) of A satisfies
where is its eigenvalue. The left eigenvector
of
satisfies
where denotes the transpose of
. The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
int dgelss_ | ( | int * | m, |
int * | n, | ||
int * | nrhs, | ||
double * | a, | ||
int * | lda, | ||
double * | b, | ||
int * | ldb, | ||
double * | s, | ||
double * | rcond, | ||
int * | rank, | ||
double * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes the minimum norm solution to a real linear least squares problem:
Minimize .
Using the singular value decomposition (SVD) of .
is an M-by-N matrix which may be rank-deficient.
Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix and the N-by-NRHS solution matrix
.
The effective rank of is determined by treating as zero those singular values which are less than RCOND times the largest singular value.
void dgemm_ | ( | char * | transa, |
char * | transb, | ||
int * | m, | ||
int * | n, | ||
int * | k, | ||
double * | alpha, | ||
double * | a, | ||
int * | lda, | ||
double * | b, | ||
int * | ldb, | ||
double * | beta, | ||
double * | c, | ||
int * | ldc | ||
) |
Performs one of the matrix-matrix operations:
where is one of
or
,
and
are scalars, and
,
and
are matrices, with
an m by k matrix,
a k by n matrix and
an m by n matrix
void dgemv_ | ( | char * | trans, |
int * | m, | ||
int * | n, | ||
double * | alpha, | ||
double * | a, | ||
int * | lda, | ||
double * | x, | ||
int * | incx, | ||
double * | beta, | ||
double * | y, | ||
int * | incy | ||
) |
Performs one of the matrix-vector operations
or
where and
are scalars,
and
are vectors and
is an m by n matrix.
void dgeqp3_ | ( | int * | m, |
int * | n, | ||
double * | A, | ||
int * | lda, | ||
int * | jpvt, | ||
double * | tau, | ||
double * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes a QR factorization with column pivoting of a matrix :
using Level 3 BLAS.
int dgesvd_ | ( | char * | jobu, |
char * | jobvt, | ||
int * | m, | ||
int * | n, | ||
double * | a, | ||
int * | lda, | ||
double * | s, | ||
double * | u, | ||
int * | ldu, | ||
double * | vt, | ||
int * | ldvt, | ||
double * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes the singular value decomposition (SVD) of a real M-by-N matrix , optionally computing the left and/or right singular vectors. The SVD is written
where is an M-by-N matrix which is zero except for its min(m,n) diagonal elements,
is an M-by-M orthogonal matrix, and V is an N-by-N orthogonal matrix. The diagonal elements of
are the singular values of
; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of
and
are the left and right singular vectors of
. Note that the routine returns
, not
.
double dnrm2_ | ( | int * | n, |
double * | x, | ||
int * | incx | ||
) |
Returns the euclidean norm of a vector via the function name, so that
void dorgqr_ | ( | int * | m, |
int * | n, | ||
int * | k, | ||
double * | a, | ||
int * | lda, | ||
double * | tau, | ||
double * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Generates an M-by-N real matrix with orthonormal columns, which is defined as the first N columns of a product of K elementary reflectors of order M
as returned by SGEQRF.
int dpotrf_ | ( | char * | UPLO, |
int * | n, | ||
double * | a, | ||
int * | lda, | ||
int * | info | ||
) |
Computes the Cholesky factorization of a real symmetric positive definite matrix A.
The factorization has the form
, if UPLO = 'U', or
, if UPLO = 'L', where is an upper triangular matrix and
is lower triangular
void dscal_ | ( | int * | n, |
double * | a, | ||
double * | x, | ||
int * | incx | ||
) |
Scales a vector by a constant
void dswap_ | ( | int * | n, |
double * | sx, | ||
int * | incx, | ||
double * | sy, | ||
int * | incy | ||
) |
Interchanges two vectors. Uses unrolled loops for increments equal to 1.
int dsyev_ | ( | char * | jobz, |
char * | uplo, | ||
int * | n, | ||
double * | a, | ||
int * | lda, | ||
double * | w, | ||
double * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix A.
void dtrsm_ | ( | char * | side, |
char * | uplo, | ||
char * | transa, | ||
char * | diag, | ||
int * | m, | ||
int * | n, | ||
double * | alpha, | ||
double * | a, | ||
int * | lda, | ||
double * | b, | ||
int * | ldb | ||
) |
Solves one of the matrix equations
or
, where is a scalar,
and
are m by n matrices,
is a unit, or non-unit, upper or lower triangular matrix and
is one of
or
. The matrix
is overwritten on
.
void saxpy_ | ( | int * | n, |
float * | alpha, | ||
float * | x, | ||
int * | incx, | ||
float * | y, | ||
int * | incy | ||
) |
Constant times a vector plus a vector
void scopy_ | ( | int * | n, |
float * | x, | ||
int * | incx, | ||
float * | y, | ||
int * | incy | ||
) |
Copies a vector x to a vector y
float sdot_ | ( | int * | n, |
float * | x, | ||
int * | incx, | ||
float * | y, | ||
int * | incy | ||
) |
Dot product of two single precision vectors
int sgeev_ | ( | char * | jobvl, |
char * | jobvr, | ||
int * | n, | ||
float * | a, | ||
int * | lda, | ||
float * | wr, | ||
float * | wi, | ||
float * | vl, | ||
int * | ldvl, | ||
float * | vr, | ||
int * | ldvr, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes for an N-by-N real nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or right eigenvectors. The right eigenvector v(j) of A satisfies
where is its eigenvalue. The left eigenvector
of
satisfies
where denotes the transpose of
. The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
int sgelss_ | ( | int * | m, |
int * | n, | ||
int * | nrhs, | ||
float * | a, | ||
int * | lda, | ||
float * | b, | ||
int * | ldb, | ||
float * | s, | ||
float * | rcond, | ||
int * | rank, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes the minimum norm solution to a real linear least squares problem:
Minimize .
Using the singular value decomposition (SVD) of .
is an M-by-N matrix which may be rank-deficient.
Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix and the N-by-NRHS solution matrix
.
The effective rank of is determined by treating as zero those singular values which are less than RCOND times the largest singular value.
void sgemm_ | ( | char * | transa, |
char * | transb, | ||
int * | m, | ||
int * | n, | ||
int * | k, | ||
float * | alpha, | ||
float * | a, | ||
int * | lda, | ||
float * | b, | ||
int * | ldb, | ||
float * | beta, | ||
float * | c, | ||
int * | ldc | ||
) |
Performs one of the matrix-matrix operations:
where is one of
or
,
and
are scalars, and
,
and
are matrices, with
an m by k matrix,
a k by n matrix and
an m by n matrix
void sgemv_ | ( | char * | trans, |
int * | m, | ||
int * | n, | ||
float * | alpha, | ||
float * | a, | ||
int * | lda, | ||
float * | x, | ||
int * | incx, | ||
float * | beta, | ||
float * | y, | ||
int * | incy | ||
) |
Performs one of the matrix-vector operations
or
where and
are scalars,
and
are vectors and
is an m by n matrix.
void sgeqp3_ | ( | int * | m, |
int * | n, | ||
float * | A, | ||
int * | lda, | ||
int * | jpvt, | ||
float * | tau, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes a QR factorization with column pivoting of a matrix :
using Level 3 BLAS.
int sgesvd_ | ( | char * | jobu, |
char * | jobvt, | ||
int * | m, | ||
int * | n, | ||
float * | a, | ||
int * | lda, | ||
float * | s, | ||
float * | u, | ||
int * | ldu, | ||
float * | vt, | ||
int * | ldvt, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes the singular value decomposition (SVD) of a real M-by-N matrix , optionally computing the left and/or right singular vectors. The SVD is written
where is an M-by-N matrix which is zero except for its min(m,n) diagonal elements,
is an M-by-M orthogonal matrix, and V is an N-by-N orthogonal matrix. The diagonal elements of
are the singular values of
; they are real and non-negative, and are returned in descending order. The first min(m,n) columns of
and
are the left and right singular vectors of
. Note that the routine returns
, not
.
int sgetrf_ | ( | int * | m, |
int * | n, | ||
float * | a, | ||
int * | lda, | ||
int * | ipiv, | ||
int * | info | ||
) |
Computes an LU factorization of a general M-by-N matrix using partial pivoting with row interchanges. The factorization has the form
where is a permutation matrix,
is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and
is upper triangular (upper trapezoidal if m < n)
int sgetri_ | ( | int * | n, |
float * | a, | ||
int * | lda, | ||
int * | ipiv, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes the inverse of a matrix using the LU factorization computed by SGETRF.
This method inverts and then computes
by solving the system
for
.
float snrm2_ | ( | int * | n, |
float * | x, | ||
int * | incx | ||
) |
Returns the euclidean norm of a vector via the function name, so that
void sorgqr_ | ( | int * | m, |
int * | n, | ||
int * | k, | ||
float * | a, | ||
int * | lda, | ||
float * | tau, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Generates an M-by-N real matrix with orthonormal columns, which is defined as the first N columns of a product of K elementary reflectors of order M
as returned by SGEQRF.
int spotrf_ | ( | char * | UPLO, |
int * | n, | ||
float * | a, | ||
int * | lda, | ||
int * | info | ||
) |
Computes the Cholesky factorization of a real symmetric positive definite matrix A.
The factorization has the form
, if UPLO = 'U', or
, if UPLO = 'L', where is an upper triangular matrix and
is lower triangular
void sscal_ | ( | int * | n, |
float * | a, | ||
float * | x, | ||
int * | incx | ||
) |
Scales a vector by a constant
void sswap_ | ( | int * | n, |
float * | sx, | ||
int * | incx, | ||
float * | sy, | ||
int * | incy | ||
) |
Interchanges two vectors. Uses unrolled loops for increments equal to 1.
int ssyev_ | ( | char * | jobz, |
char * | uplo, | ||
int * | n, | ||
float * | a, | ||
int * | lda, | ||
float * | w, | ||
float * | work, | ||
int * | lwork, | ||
int * | info | ||
) |
Computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix A.
void strsm_ | ( | char * | side, |
char * | uplo, | ||
char * | transa, | ||
char * | diag, | ||
int * | m, | ||
int * | n, | ||
float * | alpha, | ||
float * | a, | ||
int * | lda, | ||
float * | b, | ||
int * | ldb | ||
) |
Solves one of the matrix equations
or
, where is a scalar,
and
are m by n matrices,
is a unit, or non-unit, upper or lower triangular matrix and
is one of
or
. The matrix
is overwritten on
.