|
STARS-H
Software for Testing Accuracy, Reliability and Scalability of Hierarchical computations
|
Routines for n-dimensional arrays. More...
Data Structures | |
| struct | array |
| N-dimensional array. More... | |
Typedefs | |
| typedef struct array | Array |
Functions | |
| int | array_from_buffer (Array **A, int ndim, int *shape, char dtype, char order, void *data) |
| Init array from given buffer. More... | |
| int | array_new (Array **A, int ndim, int *shape, char dtype, char order) |
| Init array object and allocate memory for its buffer. More... | |
| int | array_new_like (Array **A, Array *B) |
| Init new array object with the shape, dtype and order of other. More... | |
| int | array_new_copy (Array **A, Array *B, char order) |
| Init new array object as copy of other with given data layout. More... | |
| void | array_free (Array *A) |
| void | array_info (Array *A) |
| void | array_print (Array *A) |
| int | array_to_matrix (Array *A, char kind) |
| int | array_trans_inplace (Array *A) |
Transpose A by changing shape, stride and order. More... | |
| int | array_dot (Array *A, Array *B, Array **C) |
GEMM for A and B into C. More... | |
| int | array_SVD (Array *A, Array **U, Array **S, Array **V) |
Compute SVD of a given 2-dimensional A. More... | |
| int | SVD_get_rank (Array *S, double tol, char type, int *rank) |
Returns rank by given singular values S, tolerance and type of norm. More... | |
| int | array_scale (Array *A, char kind, Array *S) |
| Apply row or column scaling to A. More... | |
| int | array_diff (Array *A, Array *B, double *result) |
Measure Frobenius error of approximation of A by B. More... | |
| int | array_norm (Array *A, double *result) |
Measure Frobenius norm of A. More... | |
| int | array_convert (Array **A, Array *B, char dtype) |
Create A as a copy of B with different data type (precision). More... | |
| int | array_cholesky (Array *A, char uplo) |
Cholesky factorization for A. More... | |
Routines for n-dimensional arrays.
| int array_cholesky | ( | Array * | A, |
| char | uplo | ||
| ) |
Cholesky factorization for A.
| [in,out] | A | Pointer to Array object. |
| [in] | uplo | Store result in upper or in lower part of A. |
Create A as a copy of B with different data type (precision).
| [out] | A | Address of pointer to Array object. |
| [in] | B | Pointer to Array object. |
| [in] | dtype | New data type (precision). |
Measure Frobenius error of approximation of A by B.
| [in] | A | Pointer to Array object. |
| [in] | B | Pointer to Array object. |
| [out] | result | Address of result. |
GEMM for A and B into C.
Multiplication is performed by last dimension of A and first dimension of B. These dimensions, data types and ordering of A and B should be equal.
| [in] | A | Pointer to Array object. |
| [in] | B | Pointer to Array object. |
| [out] | C | Address of pointer to Array object. |
| int array_from_buffer | ( | Array ** | A, |
| int | ndim, | ||
| int * | shape, | ||
| char | dtype, | ||
| char | order, | ||
| void * | data | ||
| ) |
Init array from given buffer.
Memory is automatically allocated, do not forget to free it by array_free().
| [out] | A | Output array. |
| [in] | ndim | Number of dimensions of array, ndim > 1. |
| [in] | shape | Size of array in each dimension. |
| [in] | dtype | Precision of array element. |
| [in] | order | Fortran (column-major) or C (row-major) order. |
| [in] | data | Data buffer. |
| int array_new | ( | Array ** | A, |
| int | ndim, | ||
| int * | shape, | ||
| char | dtype, | ||
| char | order | ||
| ) |
Init array object and allocate memory for its buffer.
| [out] | A | Address of pointer to array object. |
| [in] | ndim | Number of dimensions of array, ndim > 1. |
| [in] | shape | Size of array in each dimension. |
| [in] | dtype | Precision of array element. |
| [in] | order | Fortran (column-major) or C (row-major) order. |
Init new array object as copy of other with given data layout.
| [out] | A | Address of pointer to array object. |
| [in] | B | Other array object. |
| [in] | order | Fortran (column-major) or C (row-major) order. |
Init new array object with the shape, dtype and order of other.
| int array_norm | ( | Array * | A, |
| double * | result | ||
| ) |
Measure Frobenius norm of A.
| [in] | A | Pointer to Array object. |
| [out] | result | Address of result. |
| void array_print | ( | Array * | A | ) |
Print array. Different rows of A are printed on different output rows.
Apply row or column scaling to A.
| [in,out] | A | Pointer to Array object. |
| [in] | kind | Row or column scaling. |
| [in] | S | Scaling factors in Array object. |
Compute SVD of a given 2-dimensional A.
| [in] | A | Pointer to Array object. |
| [out] | U | Address of pointer to Array object. |
| [out] | S | Address of pointer to Array object. |
| [out] | V | Address of pointer to Array object. |
| int array_to_matrix | ( | Array * | A, |
| char | kind | ||
| ) |
Convert array to 2-dimensional matrix by glueing different dimensions.
Convert N-dimensional A to 2-dimensional A (matrix) by collapsing dimensions. This collapse can be assumed as attempt to look at A as at a matrix with long rows (kind == 'R') or long columns (kind == 'C'). If kind is 'R', dimensions from 1 to the last are collapsed into columns. If kind is 'C', dimensions from 0 to the last minus one are collapsed into rows. Example: A of shape (2,3,4,5) will be collapsed to A of shape (2,60) if kind is 'R' or to A of shape (24,5) if kind is 'C'.
| [in,out] | A | Pointer to Array object. |
| [in] | kind | kind of collapse (into long rows or into long columns). |
| int array_trans_inplace | ( | Array * | A | ) |
Transpose A by changing shape, stride and order.
| [in,out] | A | Pointer to Array object. |
| int SVD_get_rank | ( | Array * | S, |
| double | tol, | ||
| char | type, | ||
| int * | rank | ||
| ) |
Returns rank by given singular values S, tolerance and type of norm.
| [in] | S | Pointer to Array object. |
| [in] | tol | Relative error threshold. |
| [in] | type | Frobenius or spectral norm. |
| [out] | rank | Address of rank. |