17 #include <sys/types.h> 69 STARSH_int *icol,
void *row_data,
void *col_data,
void *result,
104 char dtype,
int problem_type,
int kernel_type, ...);
240 char symm,
char dtype,
void *row_data,
void *col_data,
481 int *shape,
void **D);
540 Array **far_U,
Array **far_V,
int onfly,
Array **near_D,
void *alloc_U,
541 void *alloc_V,
void *alloc_D,
char alloc_type);
545 int *shape,
int *rank,
void **U,
void **V,
void **D);
564 int maxrank,
double tol,
int onfly);
570 double tol,
int onfly);
572 double tol,
int onfly);
574 double tol,
int onfly);
579 int maxrank,
double tol,
int onfly);
581 int maxrank,
double tol,
int onfly);
583 int maxrank,
double tol,
int onfly);
603 double *A,
int lda,
double beta,
double *B,
int ldb);
605 double *A,
int lda,
double beta,
double *B,
int ldb);
645 int ldU,
double *V,
int ldV,
int *rank,
int maxrank,
double tol,
646 double *work,
int lwork,
int *iwork);
648 int ldU,
double *V,
int ldV,
int *rank,
int maxrank,
int oversample,
649 double tol,
double *work,
int lwork,
int *iwork);
651 int ldU,
double *V,
int ldV,
int *rank,
int maxrank,
int oversample,
652 double tol,
double *work,
int lwork,
int *iwork);
654 int *rank,
int maxrank,
double tol,
double *work,
int lwork,
672 int ldb,
double *X,
int ldx,
double tol,
double *work);
689 #endif // __STARSH_H__ STARSH_int nblocks_far
Number of admissible far-field blocks.
Definition: starsh.h:384
int starsh_blrm__drsdd_omp(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Approximate each tile by randomized SVD.
Definition: drsdd.c:16
Array ** far_V
Low rank factor of each far-field block.
Definition: starsh.h:512
ssize_t STARSH_int
STARSH signed integer to support more, than MAX_INT rows/columns.
Definition: starsh.h:64
int starsh_blrm_get_block(STARSH_blrm *matrix, STARSH_int i, STARSH_int j, int *shape, int *rank, void **U, void **V, void **D)
Get shape, rank and low-rank factors or dense representation of a block.
Definition: blrm.c:200
STARSH_kernel * kernel
Pointer to a kernel.
Definition: starsh.h:229
STARSH_blrf * format
Pointer to block low-rank format.
Definition: starsh.h:503
Array ** far_U
Low rank factor of each far-field block.
Definition: starsh.h:507
STARSH_int * level
Index of first cluster for each level of hierarchy.
Definition: starsh.h:284
STARSH_int nblocks_far_local
Number of far-field blocks, stored locally on MPI node.
Definition: starsh.h:415
int starsh_blrf_new_from_coo(STARSH_blrf **format, STARSH_problem *problem, char symm, STARSH_cluster *row_cluster, STARSH_cluster *col_cluster, STARSH_int nblocks_far, STARSH_int *block_far, STARSH_int nblocks_near, STARSH_int *block_near, enum STARSH_BLRF_TYPE type)
Init STARSH_blrf object by lists of admissible blocks.
Definition: blrf.c:90
STARSH_problem * problem
Corresponding problem.
Definition: starsh.h:372
void starsh_cluster_free(STARSH_cluster *cluster)
Definition: cluster.c:70
enum STARSH_BACKEND backend
What backend to use (e.g. MPI or STARPU).
Definition: starsh.h:39
int starsh_problem_new(STARSH_problem **problem, int ndim, STARSH_int *shape, char symm, char dtype, void *row_data, void *col_data, STARSH_kernel *kernel, char *name)
Init STARSH_problem object.
Definition: problem.c:16
int starsh_cluster_new_plain(STARSH_cluster **cluster, void *data, STARSH_int ndata, STARSH_int block_size)
Plain division of data into blocks of discrete elements.
Definition: cluster.c:106
void * data
Pointer to data buffer.
Definition: starsh.h:149
int array_dot(Array *A, Array *B, Array **C)
GEMM for A and B into C.
Definition: array.c:488
void starsh_cluster_info(STARSH_cluster *cluster)
Definition: cluster.c:91
int array_norm(Array *A, double *result)
Measure Frobenius norm of A.
Definition: array.c:908
void starsh_blrm_free(STARSH_blrm *matrix)
Definition: blrm.c:130
int onfly
Equal to 1 to store dense blocks, 0 to compute it on demand.
Definition: starsh.h:517
int starsh_blrf_new_tlr(STARSH_blrf **format, STARSH_problem *problem, char symm, STARSH_cluster *row_cluster, STARSH_cluster *col_cluster)
TLR partitioning of problem with given plain clusters.
Definition: blrf.c:291
void * col_data
Pointer to data, corresponding to columns.
Definition: starsh.h:227
enum STARSH_BLRF_TYPE type
Type of format.
Definition: starsh.h:455
STARSH_int * start
Index of first pivoted discrete element of a cluster.
Definition: starsh.h:292
enum STARSH_CLUSTER_TYPE type
Type of cluster (tiled or hierarchical).
Definition: starsh.h:317
STARSH_int * brow_far_start
Start indexes of admissibly far block columns for each block row.
Definition: starsh.h:391
size_t dtype_size
Size of element of array in bytes.
Definition: starsh.h:216
int oversample
Oversampling parameter for RSVD and RRQR.
Definition: starsh.h:43
STARSH_BLRF_TYPE
Enum type to show actual block low-rank format.
Definition: starsh-constants.h:101
STARSH_int nblocks_near
Number of admissible near-field blocks.
Definition: starsh.h:419
void array_print(Array *A)
Definition: array.c:289
void * row_data
Pointer to data, corresponding to rows.
Definition: starsh.h:225
#define ndim
Replace variable ndim with static integer value.
Definition: kernel_sin_1d.c:28
int starsh_blrf_new(STARSH_blrf **format, STARSH_problem *problem, char symm, STARSH_cluster *row_cluster, STARSH_cluster *col_cluster, STARSH_int nbrows, STARSH_int nbcols, STARSH_int nblocks_far, STARSH_int *block_far, STARSH_int *brow_far_start, STARSH_int *brow_far, STARSH_int *bcol_far_start, STARSH_int *bcol_far, STARSH_int nblocks_far_local, STARSH_int *block_far_local, STARSH_int nblocks_near, STARSH_int *block_near, STARSH_int *brow_near_start, STARSH_int *brow_near, STARSH_int *bcol_near_start, STARSH_int *bcol_near, STARSH_int nblocks_near_local, STARSH_int *block_near_local, enum STARSH_BLRF_TYPE type)
Init STARSH_blrf object.
Definition: blrf.c:17
void starsh_blrf_free(STARSH_blrf *format)
Definition: blrf.c:373
STARSH_int nlevels
Number of levels of hierarchy.
Definition: starsh.h:280
STARSH_BACKEND
Enum for backend types.
Definition: starsh-constants.h:17
int starsh_itersolvers__dcg_omp(STARSH_blrm *matrix, int nrhs, double *B, int ldb, double *X, int ldx, double tol, double *work)
Conjugate gradient method for STARSH_blrm object.
Definition: cg.c:24
STARSH_int nbrows
Number of block rows (clusters of rows).
Definition: starsh.h:380
int * shape
Shape of array.
Definition: starsh.h:127
void * data
Pointer to structure, holding physical data.
Definition: starsh.h:266
int starsh_problem_get_block(STARSH_problem *problem, int nrows, int ncols, STARSH_int *irow, STARSH_int *icol, Array **A)
Get submatrix on given rows and columns.
Definition: problem.c:130
int STARSH_blrm_approximate(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Typedef for prototype of approximation routine.
Definition: starsh.h:563
STARSH_int * block_far
Coordinates of far-field admissible blocks.
Definition: starsh.h:386
Structure for built-in STARS-H parameters.
Definition: starsh.h:37
STARSH_int * bcol_far
List of admissibly far block rows for each block column.
Definition: starsh.h:409
STARSH_int * shape
Shape of corresponding array.
Definition: starsh.h:202
void array_free(Array *A)
Definition: array.c:248
int starsh_blrf_get_block(STARSH_blrf *format, STARSH_int i, STARSH_int j, int *shape, void **D)
Returns dense block on intersection of given block row and column.
Definition: blrf.c:471
size_t data_nbytes
Size of low-rank factors and dense blocks in block low-rank matrix.
Definition: starsh.h:535
char dtype
Precision of problem and corresponding array.
Definition: starsh.h:211
size_t data_nbytes
Size of data buffer in bytes.
Definition: starsh.h:147
char symm
'S' if format is symmetric and 'N' otherwise.
Definition: starsh.h:374
int array_diff(Array *A, Array *B, double *result)
Measure Frobenius error of approximation of A by B.
Definition: array.c:818
STARSH_int * block_far_local
List of far-field blocks, stored locally on MPI node.
Definition: starsh.h:417
int starsh_blrm__dmml(STARSH_blrm *matrix, int nrhs, double alpha, double *A, int lda, double beta, double *B, int ldb)
Multiply blr-matrix by dense matrix.
Definition: dmml.c:16
int array_new_like(Array **A, Array *B)
Init new array object with the shape, dtype and order of other.
Definition: array.c:145
int array_scale(Array *A, char kind, Array *S)
Apply row or column scaling to A.
Definition: array.c:752
Non-nested block-wise low-rank format.
Definition: starsh.h:345
char alloc_type
Type of memory allocation.
Definition: starsh.h:527
void array_info(Array *A)
Definition: array.c:263
int starsh_init()
Initialize backend and low-rank engine to be used.
Definition: init.c:26
int starsh_blrm__dsdd(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Approximate each tile by divide-and-conquer SVD (GESDD function).
Definition: dsdd.c:16
STARSH_cluster * row_cluster
Clusterization of rows into subclusters (block rows).
Definition: starsh.h:376
void * alloc_U
Pointer to memory buffer, holding all far_U.
Definition: starsh.h:521
STARSH_int * child
Children clusters of each cluster.
Definition: starsh.h:310
int array_new(Array **A, int ndim, int *shape, char dtype, char order)
Init array object and allocate memory for its buffer.
Definition: array.c:119
Info about clusterization of physical data.
Definition: starsh.h:263
Matrix/tensor in matrix/tensor-free form.
Definition: starsh.h:186
int starsh_cluster_new(STARSH_cluster **cluster, void *data, STARSH_int ndata, STARSH_int *pivot, STARSH_int nblocks, STARSH_int nlevels, STARSH_int *level, STARSH_int *start, STARSH_int *size, STARSH_int *parent, STARSH_int *child_start, STARSH_int *child, enum STARSH_CLUSTER_TYPE type)
Init STARSH_cluster object.
Definition: cluster.c:16
size_t nbytes
Total size of block low-rank matrix, including auxiliary buffers.
Definition: starsh.h:533
STARSH_int * block_near_local
List of near-field blocks, stored locally on MPI node.
Definition: starsh.h:453
STARSH_int * parent
Parent cluster for each subcluster.
Definition: starsh.h:299
N-dimensional array.
Definition: starsh.h:120
STARSH_int * brow_near_start
Start indexes of admissibly near block colums for each block row.
Definition: starsh.h:427
STARSH_int nblocks
Total number of subclusters (blocks) of discrete elements.
Definition: starsh.h:278
void starsh_dense_dlrsdd(int nrows, int ncols, double *D, int ldD, double *U, int ldU, double *V, int ldV, int *rank, int maxrank, double tol, double *work, int lwork, int *iwork)
SVD approximation of a dense double precision matrix.
Definition: dsdd.c:16
int array_convert(Array **A, Array *B, char dtype)
Create A as a copy of B with different data type (precision).
Definition: array.c:945
size_t entry_size
Size of subarray, corresponding to kernel shape, in bytes.
Definition: starsh.h:218
int starsh_blrm__dmml_omp(STARSH_blrm *matrix, int nrhs, double alpha, double *A, int lda, double beta, double *B, int ldb)
Multiply blr-matrix by dense matrix.
Definition: dmml.c:16
double starsh_blrm__dfe(STARSH_blrm *matrix)
Approximation error in Frobenius norm of double precision matrix.
Definition: dfe.c:16
int starsh_dense_dsvfr(int size, double *S, double tol)
Returns rank of double precision singular values.
Definition: dsvfr.c:16
size_t size
Number of elements of array.
Definition: starsh.h:136
STARSH_int * brow_near
List of admissibly near block columns for each block row.
Definition: starsh.h:433
int array_new_copy(Array **A, Array *B, char order)
Init new array object as copy of other with given data layout.
Definition: array.c:180
int array_cholesky(Array *A, char uplo)
Cholesky factorization for A.
Definition: array.c:1128
int starsh_set_lrengine(const char *string)
Set low-rank engine (SVD, Randomized SVD or Cross) for computations.
Definition: init.c:111
void STARSH_kernel(int nrows, int ncols, STARSH_int *irow, STARSH_int *icol, void *row_data, void *col_data, void *result, int ld)
Definition: starsh.h:68
int starsh_problem_from_array(STARSH_problem **problem, Array *A, char symm)
Create STARSH_problem instance, based on dense array.
Definition: problem.c:227
int array_from_buffer(Array **A, int ndim, int *shape, char dtype, char order, void *data)
Init array from given buffer.
Definition: array.c:16
STARSH_int * child_start
Start index of child for each cluster.
Definition: starsh.h:303
int SVD_get_rank(Array *S, double tol, char type, int *rank)
Returns rank by given singular values S, tolerance and type of norm.
Definition: array.c:666
Array ** near_D
Array of pointers to dense near-field blocks.
Definition: starsh.h:519
STARSH_int * size
Number of discrete elements in each cluster.
Definition: starsh.h:297
void starsh_problem_info(STARSH_problem *problem)
Definition: problem.c:116
void * alloc_V
Pointer to memory buffer, holding all far_V.
Definition: starsh.h:523
int array_trans_inplace(Array *A)
Transpose A by changing shape, stride and order.
Definition: array.c:458
int starsh_set_backend(const char *string)
Set backend (MPI or OpenMP or other scheduler) for computations.
Definition: init.c:69
int starsh_blrm__drsdd(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Approximate each tile by randomized SVD.
Definition: drsdd.c:16
void * alloc_D
Pointer to memory buffer, holding all near_D.
Definition: starsh.h:525
double starsh_blrm__dfe_omp(STARSH_blrm *matrix)
Approximation error in Frobenius norm of double precision matrix.
Definition: dfe.c:16
size_t dtype_size
Size of one element of array in bytes.
Definition: starsh.h:143
STARSH_int nbcols
Number of block columns (clusters of columns).
Definition: starsh.h:382
void starsh_blrf_print(STARSH_blrf *format)
Definition: blrf.c:422
STARSH_int nblocks_near_local
Number of near-field blocks, stored locally on MPI node.
Definition: starsh.h:451
void starsh_dense_dlrrsdd(int nrows, int ncols, double *D, int ldD, double *U, int ldU, double *V, int ldV, int *rank, int maxrank, int oversample, double tol, double *work, int lwork, int *iwork)
Randomized SVD approximation of a dense double precision matrix.
Definition: drsdd.c:16
char * name
Name of corresponding problem.
Definition: starsh.h:235
int ndim
Number of dimensions of array.
Definition: starsh.h:125
int array_to_matrix(Array *A, char kind)
Definition: array.c:408
STARSH_int * pivot
Pivoting of discrete elements for clusterization.
Definition: starsh.h:273
STARSH_LRENGINE
Enum for low-rank engine (approximation technique)
Definition: starsh-constants.h:44
char dtype
Precision of array.
Definition: starsh.h:138
ssize_t * stride
Strides of array.
Definition: starsh.h:129
STARSH_int * bcol_far_start
Start indexes of admissibly far block rows for each block column.
Definition: starsh.h:403
STARSH_blrm_approximate * starsh_blrm_approximate
Definition: init.c:24
STARSH_CLUSTER_TYPE
Enum type to show type of clusterization.
Definition: starsh-constants.h:112
void starsh_problem_free(STARSH_problem *problem)
Definition: problem.c:104
char order
Ordering of array.
Definition: starsh.h:131
void starsh_dense_dlrqp3(int nrows, int ncols, double *D, int ldD, double *U, int ldU, double *V, int ldV, int *rank, int maxrank, int oversample, double tol, double *work, int lwork, int *iwork)
Rank-revealing QR approximation of a dense double precision matrix.
Definition: dqp3.c:16
int starsh_set_oversample(const char *string)
Set oversampling size for randomized SVD and RRQR.
Definition: init.c:149
int starsh_problem_to_array(STARSH_problem *problem, Array **A)
Generate dense array by a given problem.
Definition: problem.c:279
int array_SVD(Array *A, Array **U, Array **S, Array **V)
Compute SVD of a given 2-dimensional A.
Definition: array.c:579
int ndim
Number of dimensions of corresponding problem.
Definition: starsh.h:196
STARSH_int ndata
Number of discrete elements, corresponding to physical data.
Definition: starsh.h:268
int starsh_blrm_new(STARSH_blrm **matrix, STARSH_blrf *format, int *far_rank, Array **far_U, Array **far_V, int onfly, Array **near_D, void *alloc_U, void *alloc_V, void *alloc_D, char alloc_type)
Init STARSH_blrm object.
Definition: blrm.c:17
void starsh_blrf_info(STARSH_blrf *format)
Definition: blrf.c:407
int starsh_blrm__dqp3(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Approximate each tile of BLR matrix with RRQR (GEQP3 function).
Definition: dqp3.c:16
void starsh_dense_dlrna(int nrows, int ncols, double *D, double *U, double *V, int *rank, int maxrank, double tol, double *work, int lwork, int *iwork)
Fake approximation schemes, that returns rank=-1.
Definition: dna.c:16
Non-nested block low-rank matrix.
Definition: starsh.h:497
STARSH_int * bcol_near_start
Start indexes of admissibly near block rows for each block column.
Definition: starsh.h:439
enum STARSH_LRENGINE lrengine
What low-rank engine to use (e.g. RSVD).
Definition: starsh.h:41
size_t nbytes
Size of data buffer and array structure together in bytes.
Definition: starsh.h:145
STARSH_int * bcol_near
List of admissibly near block rows for each block column.
Definition: starsh.h:445
STARSH_int * brow_far
List of admissibly far block columns for each block row.
Definition: starsh.h:397
void starsh_blrm_info(STARSH_blrm *matrix)
Definition: blrm.c:189
int starsh_blrm__dqp3_omp(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Approximate each tile of BLR matrix with RRQR (GEQP3 function).
Definition: dqp3.c:16
char symm
‘'S’if problem is symmetric, and'N'` otherwise.
Definition: starsh.h:209
int starsh_blrm__dsdd_omp(STARSH_blrm **matrix, STARSH_blrf *format, int maxrank, double tol, int onfly)
Approximate each tile by divide-and-conquer SVD (GESDD function).
Definition: dsdd.c:16
STARSH_int * block_near
Coordinates of near-field admissible blocks.
Definition: starsh.h:422
int starsh_blrm__dca(STARSH_blrm *matrix, Array *A)
Convert double precision block low-rank matrix to dense Array.
Definition: dca.c:16
int * far_rank
Rank of each far-field block.
Definition: starsh.h:505
int starsh_application(void **data, STARSH_kernel **kernel, STARSH_int count, char dtype, int problem_type, int kernel_type,...)
Generates data and matrix kernel for one of predefined applications.
Definition: common.c:22
STARSH_cluster * col_cluster
Clusterization of columns into subclusters (block columns).
Definition: starsh.h:378