The interface description of the COSTA matrix component. For user implementation see cta_usr_matrix.h. More...
#include "cta_system.h"
#include "cta_handles.h"
#include "cta_datatypes.h"
#include "cta_functions.h"
#include "cta_vector.h"
Go to the source code of this file.
Defines | |
#define | CTA_MATRIX_CREATE_SIZE ( 1) |
#define | CTA_MATRIX_CREATE_INIT ( 2) |
#define | I_CTA_MATRIX_GETVALS ( 4) |
#define | I_CTA_MATRIX_GETVAL ( 5) |
#define | I_CTA_MATRIX_SETCOL ( 6) |
#define | I_CTA_MATRIX_SETVALS ( 7) |
#define | I_CTA_MATRIX_SETVAL ( 8) |
#define | I_CTA_MATRIX_SETCONST ( 9) |
#define | I_CTA_MATRIX_FREE (10) |
#define | I_CTA_MATRIX_EXPORT (11) |
#define | I_CTA_MATRIX_GER (12) |
#define | I_CTA_MATRIX_INV (13) |
#define | I_CTA_MATRIX_GEMV (14) |
#define | I_CTA_MATRIX_GEMM (15) |
#define | I_CTA_MATRIX_AXPY (16) |
#define | CTA_MATRIX_NUMFUNC (17) |
Typedefs | |
typedef CTA_Handle | CTA_Matrix |
typedef CTA_Handle | CTA_MatClass |
Functions | |
CTAEXPORT int | CTA_Matrix_DefineClass (const char *name, const CTA_Func h_func[CTA_MATRIX_NUMFUNC], CTA_MatClass *hmatcl) |
Create a new class (=implementation) of a COSTA matrix component. | |
CTAEXPORT int | CTA_Matrix_Duplicate (CTA_Matrix hmat1, CTA_Matrix *hmat2) |
Duplicate a matrix instance. | |
CTAEXPORT int | CTA_Matrix_Create (CTA_MatClass hmatcl, const int m, const int n, CTA_Datatype datatype, CTA_Handle userdata, CTA_Matrix *hmat) |
Create a new matrix. | |
CTAEXPORT int | CTA_Matrix_GetSize (CTA_Matrix hmat, int *m, int *n) |
CTAEXPORT int | CTA_Matrix_GetDatatype (CTA_Matrix hmat, CTA_Datatype *datatype) |
Get datatype of matrix. | |
CTAEXPORT int | CTA_Matrix_GetVals (CTA_Matrix hmat, void *vals, int m, int n, CTA_Datatype datatype) |
Get copy of all values in matrix. | |
CTAEXPORT int | CTA_Matrix_GetVal (CTA_Matrix hmat, void *val, int m, int n, CTA_Datatype datatype) |
Get copy of single value in the matrix. | |
CTAEXPORT int | CTA_Matrix_SetConstant (CTA_Matrix hmat, void *val, CTA_Datatype datatype) |
Set whole matrix to one single value. | |
CTAEXPORT int | CTA_Matrix_SetCol (CTA_Matrix hmat, int n, CTA_Vector hvec) |
Set values of a single column of the matrix. | |
CTAEXPORT int | CTA_Matrix_SetVals (CTA_Matrix hmat, void *vals, int m, int n, CTA_Datatype datatype) |
Set all values of the matrix. | |
CTAEXPORT int | CTA_Matrix_SetVal (CTA_Matrix hmat, void *val, int m, int n, CTA_Datatype datatype) |
Set a single value in the matrix. | |
CTAEXPORT int | CTA_Matrix_Export (CTA_Matrix hmat, CTA_Handle usedoc) |
Export a matrix. | |
CTAEXPORT int | CTA_Matrix_Ger (CTA_Matrix hmat, double alpha, CTA_Vector vx, CTA_Vector vy) |
Perform a rank 1 operation A:=alpha*x*y'+A. | |
CTAEXPORT int | CTA_Matrix_Inv (CTA_Matrix hmat) |
Compute inverse of a square matrix A:=inv(A). | |
CTAEXPORT int | CTA_Matrix_Gemv (CTA_Matrix hmat, int trans, double alpha, CTA_Vector vx, double beta, CTA_Vector vy) |
Perform the matrix multiplication y:=alpha*OP(A)*x+beta*y where op(X)=X, X^T. | |
CTAEXPORT int | CTA_Matrix_Gemm (CTA_Matrix mC, int transa, int transb, double alpha, CTA_Matrix mA, CTA_Matrix mB, double beta) |
Perform the matrix multication C:=alpha*op(A)*op(B)+beta*C where op(X)=X, X^T. | |
CTAEXPORT int | CTA_Matrix_Axpy (CTA_Matrix mY, double alpha, CTA_Matrix mX) |
Perform the matrix addition Y:=alpha*X+Y. | |
CTAEXPORT int | CTA_Matrix_EigVals (CTA_Matrix A, CTA_Vector eigvals, CTA_Matrix eigvecs) |
Computes the eigenvalues and optionally the eigenvectors of a general matrix A. | |
CTAEXPORT int | CTA_Matrix_Free (CTA_Matrix *hmat) |
Free the matrix object. |
The interface description of the COSTA matrix component. For user implementation see cta_usr_matrix.h.
CTA_Matrix is the default class implementation for matrices.
Definition in file cta_matrix.h.
#define CTA_MATRIX_CREATE_INIT ( 2) |
Definition at line 41 of file cta_matrix.h.
#define CTA_MATRIX_CREATE_SIZE ( 1) |
Definition at line 40 of file cta_matrix.h.
#define CTA_MATRIX_NUMFUNC (17) |
Definition at line 55 of file cta_matrix.h.
#define I_CTA_MATRIX_AXPY (16) |
Definition at line 54 of file cta_matrix.h.
#define I_CTA_MATRIX_EXPORT (11) |
Definition at line 49 of file cta_matrix.h.
#define I_CTA_MATRIX_FREE (10) |
Definition at line 48 of file cta_matrix.h.
#define I_CTA_MATRIX_GEMM (15) |
Definition at line 53 of file cta_matrix.h.
#define I_CTA_MATRIX_GEMV (14) |
Definition at line 52 of file cta_matrix.h.
#define I_CTA_MATRIX_GER (12) |
Definition at line 50 of file cta_matrix.h.
#define I_CTA_MATRIX_GETVAL ( 5) |
Definition at line 43 of file cta_matrix.h.
#define I_CTA_MATRIX_GETVALS ( 4) |
Definition at line 42 of file cta_matrix.h.
#define I_CTA_MATRIX_INV (13) |
Definition at line 51 of file cta_matrix.h.
#define I_CTA_MATRIX_SETCOL ( 6) |
Definition at line 44 of file cta_matrix.h.
#define I_CTA_MATRIX_SETCONST ( 9) |
Definition at line 47 of file cta_matrix.h.
#define I_CTA_MATRIX_SETVAL ( 8) |
Definition at line 46 of file cta_matrix.h.
#define I_CTA_MATRIX_SETVALS ( 7) |
Definition at line 45 of file cta_matrix.h.
typedef CTA_Handle CTA_MatClass |
Definition at line 37 of file cta_matrix.h.
typedef CTA_Handle CTA_Matrix |
Definition at line 36 of file cta_matrix.h.
CTAEXPORT int CTA_Matrix_Axpy | ( | CTA_Matrix | mY, | |
double | alpha, | |||
CTA_Matrix | mX | |||
) |
Perform the matrix addition Y:=alpha*X+Y.
mY | IO handle of matrix Y | |
alpha | I scalar | |
mX | I handle of matrix X |
CTAEXPORT int CTA_Matrix_Create | ( | CTA_MatClass | hmatcl, | |
const int | m, | |||
const int | n, | |||
CTA_Datatype | datatype, | |||
CTA_Handle | userdata, | |||
CTA_Matrix * | hmat | |||
) |
Create a new matrix.
hmatcl | I matrix class of new matrix | |
m | I number of rows | |
n | I number of columns | |
datatype | I datatype of elements in matrix | |
userdata | IO userdata for creation (depends on class) | |
hmat | O receives handle of new matrix |
CTAEXPORT int CTA_Matrix_DefineClass | ( | const char * | name, | |
const CTA_Func | h_func[CTA_MATRIX_NUMFUNC], | |||
CTA_MatClass * | hmatcl | |||
) |
Create a new class (=implementation) of a COSTA matrix component.
name | I name of the new matrix class | |
h_func | I COSTA function handles for functions that implement class, missing functions must have value CTA_NULL | |
hmatcl | O receives handle of new matrix class |
CTAEXPORT int CTA_Matrix_Duplicate | ( | CTA_Matrix | hmat1, | |
CTA_Matrix * | hmat2 | |||
) |
Duplicate a matrix instance.
hmat1 | I handle of matrix to be duplicated | |
hmat2 | O receives handle of duplicate matrix, empty handle before calling |
CTAEXPORT int CTA_Matrix_EigVals | ( | CTA_Matrix | A, | |
CTA_Vector | eigvals, | |||
CTA_Matrix | eigvecs | |||
) |
Computes the eigenvalues and optionally the eigenvectors of a general matrix A.
The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
A | I Matrix A | |
eigvals | O Vector with eigenvalues | |
eigvecs | O Matrix with eigenvalues. The eigenvectors are not computed when eigvecs in CTA_NULL on entry |
CTAEXPORT int CTA_Matrix_Export | ( | CTA_Matrix | hmat, | |
CTA_Handle | usedoc | |||
) |
Export a matrix.
hmat | I handle of matrix | |
usedoc | I configuration of output |
CTAEXPORT int CTA_Matrix_Free | ( | CTA_Matrix * | hmat | ) |
Free the matrix object.
hmat=CTA_NULL is allowed
hmat | IO handle of matrix, replaced by CTA_NULL on return. |
CTAEXPORT int CTA_Matrix_Gemm | ( | CTA_Matrix | mC, | |
int | transa, | |||
int | transb, | |||
double | alpha, | |||
CTA_Matrix | mA, | |||
CTA_Matrix | mB, | |||
double | beta | |||
) |
Perform the matrix multication C:=alpha*op(A)*op(B)+beta*C where op(X)=X, X^T.
mC | IO handle of matrix C | |
transa | I transpose flag CTA_TRUE/CTA_FALSE for matrix A | |
transb | I transpose flag CTA_TRUE/CTA_FALSE for matrix A | |
alpha | I scalar | |
mA | I handle of matrix A | |
mB | I handle of matrix B | |
beta | I scalar |
CTAEXPORT int CTA_Matrix_Gemv | ( | CTA_Matrix | hmat, | |
int | trans, | |||
double | alpha, | |||
CTA_Vector | vx, | |||
double | beta, | |||
CTA_Vector | vy | |||
) |
Perform the matrix multiplication y:=alpha*OP(A)*x+beta*y where op(X)=X, X^T.
hmat | I handle of matrix (A from the equation above) | |
trans | I transpose flag CTA_TRUE/CTA_FALSE for matrix A | |
alpha | I scalar | |
vx | I vector x | |
beta | I scalar | |
vy | IO vector y |
CTAEXPORT int CTA_Matrix_Ger | ( | CTA_Matrix | hmat, | |
double | alpha, | |||
CTA_Vector | vx, | |||
CTA_Vector | vy | |||
) |
Perform a rank 1 operation A:=alpha*x*y'+A.
hmat | IO handle of matrix A | |
alpha | I scalar | |
vx | I vector x | |
vy | I vector y |
CTAEXPORT int CTA_Matrix_GetDatatype | ( | CTA_Matrix | hmat, | |
CTA_Datatype * | datatype | |||
) |
Get datatype of matrix.
hmat | I handle of matrix | |
datatype | O receives data type of matrix |
CTAEXPORT int CTA_Matrix_GetSize | ( | CTA_Matrix | hmat, | |
int * | m, | |||
int * | n | |||
) |
CTAEXPORT int CTA_Matrix_GetVal | ( | CTA_Matrix | hmat, | |
void * | val, | |||
int | m, | |||
int | n, | |||
CTA_Datatype | datatype | |||
) |
Get copy of single value in the matrix.
hmat | I handle of matrix | |
val | O receives copy of value in matrix | |
m | I row index of value to be copied | |
n | I column index of value to be copied | |
datatype | I data type of *val, must be the same as data type of matrix elements |
CTAEXPORT int CTA_Matrix_GetVals | ( | CTA_Matrix | hmat, | |
void * | vals, | |||
int | m, | |||
int | n, | |||
CTA_Datatype | datatype | |||
) |
Get copy of all values in matrix.
hmat | I handle of matrix | |
vals | O copy of values in matrix | |
m | I number of rows of vals (must be the same as for the matrix) | |
n | I number of columns of vals (must be the same as for the matrix) | |
datatype | I data type of *vals, must be the same as data type of matrix elements |
CTAEXPORT int CTA_Matrix_Inv | ( | CTA_Matrix | hmat | ) |
Compute inverse of a square matrix A:=inv(A).
hmat | IO handle of matrix A |
CTAEXPORT int CTA_Matrix_SetCol | ( | CTA_Matrix | hmat, | |
int | n, | |||
CTA_Vector | hvec | |||
) |
Set values of a single column of the matrix.
hmat | IO handle of matrix | |
n | I index of matrix column to set | |
hvec | I handle of COSTA vector the values have to be set to, length must be the same as number of rows of matrix |
CTAEXPORT int CTA_Matrix_SetConstant | ( | CTA_Matrix | hmat, | |
void * | val, | |||
CTA_Datatype | datatype | |||
) |
Set whole matrix to one single value.
hmat | IO handle of matrix | |
val | I value that must be set | |
datatype | I data type of *val, must be the same as data type of matrix elements |
CTAEXPORT int CTA_Matrix_SetVal | ( | CTA_Matrix | hmat, | |
void * | val, | |||
int | m, | |||
int | n, | |||
CTA_Datatype | datatype | |||
) |
Set a single value in the matrix.
hmat | IO handle of matrix | |
val | I value to be set at position (m,n) | |
m | I row index | |
n | I column index | |
datatype | I data type of *val, must be the same as data type of matrix elements |
CTAEXPORT int CTA_Matrix_SetVals | ( | CTA_Matrix | hmat, | |
void * | vals, | |||
int | m, | |||
int | n, | |||
CTA_Datatype | datatype | |||
) |
Set all values of the matrix.
hmat | IO handle of matrix | |
vals | I copy of values in matrix | |
m | I number of rows of vals (must be the same as for the matrix) | |
n | I number of columns of vals (must be the same as for the matrix) | |
datatype | I data type of vals |