Interface description of the default COSTA vector componennt. For user implementation see cta_usr_vector.h. More...
#include "cta_system.h"
#include "cta_handles.h"
#include "cta_datatypes.h"
#include "cta_functions.h"
Go to the source code of this file.
Defines | |
#define | I_CTA_VECTOR_CREATE_SIZE ( 1) |
#define | I_CTA_VECTOR_CREATE_INIT ( 2) |
#define | I_CTA_VECTOR_GETVALS ( 3) |
#define | I_CTA_VECTOR_SETVALS ( 4) |
#define | I_CTA_VECTOR_SETCONST ( 5) |
#define | I_CTA_VECTOR_SCAL ( 6) |
#define | I_CTA_VECTOR_COPY ( 7) |
#define | I_CTA_VECTOR_AXPY ( 8) |
#define | I_CTA_VECTOR_DOT ( 9) |
#define | I_CTA_VECTOR_NRM2 (10) |
#define | I_CTA_VECTOR_AMAX (11) |
#define | I_CTA_VECTOR_GETMAXLEN (12) |
#define | I_CTA_VECTOR_FREE (13) |
#define | I_CTA_VECTOR_GETVAL (14) |
#define | I_CTA_VECTOR_SETVAL (15) |
#define | I_CTA_VECTOR_EXPORT (16) |
#define | I_CTA_VECTOR_PRINT_TABLE (17) |
#define | I_CTA_VECTOR_APPENDVAL (18) |
#define | I_CTA_VECTOR_ELMDIV (19) |
#define | I_CTA_VECTOR_IMPORT (20) |
#define | I_CTA_VECTOR_ELMPROD (21) |
#define | I_CTA_VECTOR_ELMSQRT (22) |
#define | I_CTA_VECTOR_NUMFUNC (23) |
Typedefs | |
typedef CTA_Handle | CTA_Vector |
typedef CTA_Handle | CTA_VecClass |
Functions | |
CTAEXPORT int | CTA_Vector_DefineClass (const char *name, const CTA_Func h_func[I_CTA_VECTOR_NUMFUNC], CTA_VecClass *hveccl) |
Create a new class (=implementation) of a COSTA vector component. | |
CTAEXPORT int | CTA_Vector_Duplicate (CTA_Vector hvector1, CTA_Vector *hvector2) |
Duplicate a vector object. | |
CTAEXPORT int | CTA_Vector_Create (CTA_VecClass hveccl, const int n, CTA_Datatype datatype, CTA_Handle userdata, CTA_Vector *hvector) |
Create a new vector. | |
CTAEXPORT int | CTA_Vector_GetSize (CTA_Vector hvec, int *n) |
Get size of vector. | |
CTAEXPORT int | CTA_Vector_GetVal (CTA_Vector hvec, int i, void *vals, CTA_Datatype datatype) |
Get a copy of a single element in the vector. | |
CTAEXPORT int | CTA_Vector_GetVals (CTA_Vector hvec, void *vals, int n, CTA_Datatype datatype) |
Get a copy of all elements in the vector. | |
CTAEXPORT int | CTA_Vector_SetVal (CTA_Vector hvec, int i, void *val, CTA_Datatype datatype) |
Set a copy of an element in the vector. | |
CTAEXPORT int | CTA_Vector_AppendVal (CTA_Vector hvec, const void *val, CTA_Datatype datatype) |
Append a copy of an element to a vector. | |
CTAEXPORT int | CTA_Vector_SetVals (CTA_Vector hvec, void *vals, int n, CTA_Datatype datatype) |
Set all elementes in the vector. | |
CTAEXPORT int | CTA_Vector_Scal (CTA_Vector hvec, double alpha) |
Scale a vector. | |
CTAEXPORT int | CTA_Vector_Copy (CTA_Vector hvec_x, CTA_Vector hvec_y) |
Copy a vector. | |
CTAEXPORT int | CTA_Vector_Axpy (CTA_Vector hvec_y, double alpha, CTA_Vector hvec_x) |
Operation axpy for two vectors x and y. | |
CTAEXPORT int | CTA_Vector_Dot (CTA_Vector hvec_x, CTA_Vector hvec_y, double *dotprod) |
Dot product operation of two vectors. | |
CTAEXPORT int | CTA_Vector_Nrm2 (CTA_Vector hvec_x, double *norm2) |
Compute 2-norm of vector. | |
CTAEXPORT int | CTA_Vector_Amax (CTA_Vector hvec_x, int *iloc) |
Find index of element in vector with largest absolute value. | |
CTAEXPORT int | CTA_Vector_GetMaxLen (CTA_Vector hvec_x, int *maxlen) |
Find largest length of elements in vector. | |
CTAEXPORT int | CTA_Vector_Export (CTA_Vector hvec, CTA_Handle usrdata) |
Export a vector to file, stdout or pack object. | |
CTAEXPORT int | CTA_Vector_Import (CTA_Vector hvec, CTA_Handle usrdata) |
Import a vector. | |
CTAEXPORT int | CTA_Vector_Print_Table (CTA_Vector *table, int ncolumns, CTA_Vector vformats) |
Print table, each column built up by a vector. | |
CTAEXPORT int | CTA_Vector_Free (CTA_Vector *hvec_x) |
Free the vector object. | |
CTAEXPORT int | CTA_Vector_GetDatatype (CTA_Vector hvec, CTA_Datatype *datatype) |
Get type of vector. | |
CTAEXPORT int | CTA_Vector_SetConstant (CTA_Vector hvec, void *val, CTA_Datatype datatype) |
Set whole vector to one single value. | |
CTAEXPORT int | CTA_Vector_ElmDiv (CTA_Vector hvec_y, CTA_Vector hvec_x) |
Element wise division. | |
CTAEXPORT int | CTA_Vector_ElmProd (CTA_Vector hvec_y, CTA_Vector hvec_x) |
Element wise product. | |
CTAEXPORT int | CTA_Vector_ElmSqrt (CTA_Vector hvec_x) |
Element wise square root. |
Interface description of the default COSTA vector componennt. For user implementation see cta_usr_vector.h.
Basic functions and utilities for vector operations on CTA_VECTOR objects.
Definition in file cta_vector.h.
#define I_CTA_VECTOR_AMAX (11) |
Definition at line 49 of file cta_vector.h.
#define I_CTA_VECTOR_APPENDVAL (18) |
Definition at line 56 of file cta_vector.h.
#define I_CTA_VECTOR_AXPY ( 8) |
Definition at line 46 of file cta_vector.h.
#define I_CTA_VECTOR_COPY ( 7) |
Definition at line 45 of file cta_vector.h.
#define I_CTA_VECTOR_CREATE_INIT ( 2) |
Definition at line 40 of file cta_vector.h.
#define I_CTA_VECTOR_CREATE_SIZE ( 1) |
Definition at line 39 of file cta_vector.h.
#define I_CTA_VECTOR_DOT ( 9) |
Definition at line 47 of file cta_vector.h.
#define I_CTA_VECTOR_ELMDIV (19) |
Definition at line 57 of file cta_vector.h.
#define I_CTA_VECTOR_ELMPROD (21) |
Definition at line 59 of file cta_vector.h.
#define I_CTA_VECTOR_ELMSQRT (22) |
Definition at line 60 of file cta_vector.h.
#define I_CTA_VECTOR_EXPORT (16) |
Definition at line 54 of file cta_vector.h.
#define I_CTA_VECTOR_FREE (13) |
Definition at line 51 of file cta_vector.h.
#define I_CTA_VECTOR_GETMAXLEN (12) |
Definition at line 50 of file cta_vector.h.
#define I_CTA_VECTOR_GETVAL (14) |
Definition at line 52 of file cta_vector.h.
#define I_CTA_VECTOR_GETVALS ( 3) |
Definition at line 41 of file cta_vector.h.
#define I_CTA_VECTOR_IMPORT (20) |
Definition at line 58 of file cta_vector.h.
#define I_CTA_VECTOR_NRM2 (10) |
Definition at line 48 of file cta_vector.h.
#define I_CTA_VECTOR_NUMFUNC (23) |
Definition at line 61 of file cta_vector.h.
#define I_CTA_VECTOR_PRINT_TABLE (17) |
Definition at line 55 of file cta_vector.h.
#define I_CTA_VECTOR_SCAL ( 6) |
Definition at line 44 of file cta_vector.h.
#define I_CTA_VECTOR_SETCONST ( 5) |
Definition at line 43 of file cta_vector.h.
#define I_CTA_VECTOR_SETVAL (15) |
Definition at line 53 of file cta_vector.h.
#define I_CTA_VECTOR_SETVALS ( 4) |
Definition at line 42 of file cta_vector.h.
typedef CTA_Handle CTA_VecClass |
Definition at line 36 of file cta_vector.h.
typedef CTA_Handle CTA_Vector |
Definition at line 35 of file cta_vector.h.
CTAEXPORT int CTA_Vector_Amax | ( | CTA_Vector | hvec_x, | |
int * | iloc | |||
) |
Find index of element in vector with largest absolute value.
hvec_x | I handle of vector | |
iloc | O receives index of largest absolute value |
CTAEXPORT int CTA_Vector_AppendVal | ( | CTA_Vector | hvec, | |
const void * | val, | |||
CTA_Datatype | datatype | |||
) |
Append a copy of an element to a vector.
hvec | IO handle of vector | |
val | I value that needs to be added to vector | |
datatype | I data type of *val, must be the same as data type of elements in vector |
CTAEXPORT int CTA_Vector_Axpy | ( | CTA_Vector | hvec_y, | |
double | alpha, | |||
CTA_Vector | hvec_x | |||
) |
Operation axpy for two vectors x and y.
hvec_y | IO handle of vector y | |
alpha | I scalar | |
hvec_x | I handle of vector x |
CTAEXPORT int CTA_Vector_Copy | ( | CTA_Vector | hvec_x, | |
CTA_Vector | hvec_y | |||
) |
Copy a vector.
hvec_x | I handle of sending vector | |
hvec_y | O handle of receiving vector |
CTAEXPORT int CTA_Vector_Create | ( | CTA_VecClass | hveccl, | |
const int | n, | |||
CTA_Datatype | datatype, | |||
CTA_Handle | userdata, | |||
CTA_Vector * | hvector | |||
) |
Create a new vector.
hveccl | I vector class of new vector | |
n | I number of elements | |
datatype | I data type of elements in vector | |
userdata | IO user data for creation (depends on class) | |
hvector | O receives handle of new vector |
CTAEXPORT int CTA_Vector_DefineClass | ( | const char * | name, | |
const CTA_Func | h_func[I_CTA_VECTOR_NUMFUNC], | |||
CTA_VecClass * | hveccl | |||
) |
Create a new class (=implementation) of a COSTA vector component.
name | I name of the new vector class | |
h_func | I COSTA function handles for functions that implement class. Missing functions must have value CTA_NULL | |
hveccl | O receives handle of new vector class |
CTAEXPORT int CTA_Vector_Dot | ( | CTA_Vector | hvec_x, | |
CTA_Vector | hvec_y, | |||
double * | dotprod | |||
) |
Dot product operation of two vectors.
hvec_x | I handle of vector x | |
hvec_y | I handle of vector y | |
dotprod | O receives dot product |
CTAEXPORT int CTA_Vector_Duplicate | ( | CTA_Vector | hvector1, | |
CTA_Vector * | hvector2 | |||
) |
Duplicate a vector object.
hvector1 | I handle of vector to be duplicated | |
hvector2 | O receives handle of new duplicate vector, empty before calling |
CTAEXPORT int CTA_Vector_ElmDiv | ( | CTA_Vector | hvec_y, | |
CTA_Vector | hvec_x | |||
) |
Element wise division.
hvec_y | IO handle of vector y | |
hvec_x | I handle of vector x |
CTAEXPORT int CTA_Vector_ElmProd | ( | CTA_Vector | hvec_y, | |
CTA_Vector | hvec_x | |||
) |
Element wise product.
hvec_y | IO handle of vector y | |
hvec_x | I handle of vector x |
CTAEXPORT int CTA_Vector_ElmSqrt | ( | CTA_Vector | hvec_x | ) |
Element wise square root.
hvec_x | IO handle of vector y |
CTAEXPORT int CTA_Vector_Export | ( | CTA_Vector | hvec, | |
CTA_Handle | usrdata | |||
) |
Export a vector to file, stdout or pack object.
CTA_DEFAULT_VECTOR supports exporting to:
file (usrdata a handle of COSTA file)
pack object (usrdata a handle of COSTA pack object)
hvec | I handle of vector | |
usrdata | I configuration of output |
CTAEXPORT int CTA_Vector_Free | ( | CTA_Vector * | hvec_x | ) |
Free the vector object.
hvec_x=CTA_NULL is allowed
hvec_x | IO handle of vector, replaced by CTA_NULL on return |
CTAEXPORT int CTA_Vector_GetDatatype | ( | CTA_Vector | hvec, | |
CTA_Datatype * | datatype | |||
) |
Get type of vector.
hvec | I handle of vector | |
datatype | O receives data type of vector |
CTAEXPORT int CTA_Vector_GetMaxLen | ( | CTA_Vector | hvec_x, | |
int * | maxlen | |||
) |
Find largest length of elements in vector.
hvec_x | I handle of vector | |
maxlen | O receives largest length of elements in vector |
CTAEXPORT int CTA_Vector_GetSize | ( | CTA_Vector | hvec, | |
int * | n | |||
) |
Get size of vector.
hvec | I handle of vector | |
n | O receives number of elements |
CTAEXPORT int CTA_Vector_GetVal | ( | CTA_Vector | hvec, | |
int | i, | |||
void * | vals, | |||
CTA_Datatype | datatype | |||
) |
Get a copy of a single element in the vector.
hvec | I handle of vector | |
i | I index of element | |
vals | O receives copy of value in vector, must exist before calling | |
datatype | I data type of *vals, must be the same as data type of elements in vector |
CTAEXPORT int CTA_Vector_GetVals | ( | CTA_Vector | hvec, | |
void * | vals, | |||
int | n, | |||
CTA_Datatype | datatype | |||
) |
Get a copy of all elements in the vector.
hvec | I handle of vector | |
vals | O receives copy of all elements in vector, must exist before calling | |
n | I length of array vals | |
datatype | I data type of *vals, must be the same as data type of elements in vector |
CTAEXPORT int CTA_Vector_Import | ( | CTA_Vector | hvec, | |
CTA_Handle | usrdata | |||
) |
Import a vector.
hvec | I handle of vector | |
usrdata | I configuration of output |
CTAEXPORT int CTA_Vector_Nrm2 | ( | CTA_Vector | hvec_x, | |
double * | norm2 | |||
) |
Compute 2-norm of vector.
hvec_x | I handle of vector x | |
norm2 | O receives 2-norm |
CTAEXPORT int CTA_Vector_Print_Table | ( | CTA_Vector * | table, | |
int | ncolumns, | |||
CTA_Vector | vformats | |||
) |
Print table, each column built up by a vector.
table | I array of vector handles, these vectors form the table to be filled | |
ncolumns | I number of columns in table (number of vector handles in table) | |
vformats | I handle of vector of string (size ncolumns) containing the formats for printing each column (C-format) |
CTAEXPORT int CTA_Vector_Scal | ( | CTA_Vector | hvec, | |
double | alpha | |||
) |
Scale a vector.
hvec | IO handle of vector | |
alpha | I scalar |
CTAEXPORT int CTA_Vector_SetConstant | ( | CTA_Vector | hvec, | |
void * | val, | |||
CTA_Datatype | datatype | |||
) |
Set whole vector to one single value.
hvec=CTA_NULL is allowed, function returns error code
hvec | IO handle of vector | |
val | I value that must be set | |
datatype | I data type of *val, must be the same as data type of elements in vector |
CTAEXPORT int CTA_Vector_SetVal | ( | CTA_Vector | hvec, | |
int | i, | |||
void * | val, | |||
CTA_Datatype | datatype | |||
) |
Set a copy of an element in the vector.
hvec | IO handle of vector | |
i | I index of element | |
val | I new value that is copied into element at given index | |
datatype | I data type of *val, must be the same as data type of elements in vector |
CTAEXPORT int CTA_Vector_SetVals | ( | CTA_Vector | hvec, | |
void * | vals, | |||
int | n, | |||
CTA_Datatype | datatype | |||
) |
Set all elementes in the vector.
hvec | IO handle of vector | |
vals | I values that need to be copied to vector | |
n | I number of elements in vals | |
datatype | I data type of *vals, must be the same as data type of elements in vector |