StructuredMatrix.h
Go to the documentation of this file.
1 /*
2  * STRUMPACK -- STRUctured Matrices PACKage, Copyright (c) 2014, The
3  * Regents of the University of California, through Lawrence Berkeley
4  * National Laboratory (subject to receipt of any required approvals
5  * from the U.S. Dept. of Energy). All rights reserved.
6  *
7  * If you have questions about your rights to use or distribute this
8  * software, please contact Berkeley Lab's Technology Transfer
9  * Department at TTD@lbl.gov.
10  *
11  * NOTICE. This software is owned by the U.S. Department of Energy. As
12  * such, the U.S. Government has been granted for itself and others
13  * acting on its behalf a paid-up, nonexclusive, irrevocable,
14  * worldwide license in the Software to reproduce, prepare derivative
15  * works, and perform publicly and display publicly. Beginning five
16  * (5) years after the date permission to assert copyright is obtained
17  * from the U.S. Department of Energy, and subject to any subsequent
18  * five (5) year renewals, the U.S. Government is granted for itself
19  * and others acting on its behalf a paid-up, nonexclusive,
20  * irrevocable, worldwide license in the Software to reproduce,
21  * prepare derivative works, distribute copies to the public, perform
22  * publicly and display publicly, and to permit others to do so.
23  *
24  * Developers: Pieter Ghysels, Francois-Henry Rouet, Xiaoye S. Li.
25  * (Lawrence Berkeley National Lab, Computational Research
26  * Division).
27  *
28  */
33 #ifndef STRUMPACK_STRUCTURED_C_H
34 #define STRUMPACK_STRUCTURED_C_H
35 
36 #include <stdint.h>
37 #include <complex.h>
38 #undef I
39 
40 #include "StrumpackConfig.hpp"
41 
46 typedef enum {
47  SP_TYPE_HSS = 0,
48  SP_TYPE_BLR,
49  SP_TYPE_HODLR,
50  SP_TYPE_HODBF,
51  SP_TYPE_BUTTERFLY,
52  SP_TYPE_LR,
53  SP_TYPE_LOSSY,
54  SP_TYPE_LOSSLESS
56 
57 
68 typedef struct CSPOptions {
69  SP_STRUCTURED_TYPE type;
70  double rel_tol;
71  double abs_tol;
72  int leaf_size;
73  int max_rank;
74  int verbose;
75 } CSPOptions;
76 
77 
85 typedef void* CSPStructMat;
86 
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92  // TODO:
93  // - query statistics: memory usage, levels, rank, ...
94  // - more construction routines, matvec, ..
95  // - pass clustertree?
96  // - in HODLR/HODBF store the MPIComm instead of a pointer!!
97 
122 
123 
152 
153 
174 
175 
196 
197 
204  long long int SP_s_struct_memory(const CSPStructMat S);
211  long long int SP_d_struct_memory(const CSPStructMat S);
218  long long int SP_c_struct_memory(const CSPStructMat S);
225  long long int SP_z_struct_memory(const CSPStructMat S);
226 
227 
233  long long int SP_s_struct_nonzeros(const CSPStructMat S);
239  long long int SP_d_struct_nonzeros(const CSPStructMat S);
245  long long int SP_c_struct_nonzeros(const CSPStructMat S);
251  long long int SP_z_struct_nonzeros(const CSPStructMat S);
252 
253 
278 
279 
295  int SP_s_struct_from_dense(CSPStructMat* S, int rows, int cols,
296  const float* A, int ldA,
297  const CSPOptions* opts);
313  int SP_d_struct_from_dense(CSPStructMat* S, int rows, int cols,
314  const double* A, int ldA,
315  const CSPOptions* opts);
331  int SP_c_struct_from_dense(CSPStructMat* S, int rows, int cols,
332  const float _Complex* A, int ldA,
333  const CSPOptions* opts);
349  int SP_z_struct_from_dense(CSPStructMat* S, int rows, int cols,
350  const double _Complex* A, int ldA,
351  const CSPOptions* opts);
352 
353 
354  int SP_s_struct_from_elements(CSPStructMat* S, int rows, int cols,
355  float(int i, int j),
356  const CSPOptions* opts);
357  int SP_d_struct_from_elements(CSPStructMat* S, int rows, int cols,
358  double(int i, int j),
359  const CSPOptions* opts);
360  int SP_c_struct_from_elements(CSPStructMat* S, int rows, int cols,
361  float _Complex(int i, int j),
362  const CSPOptions* opts);
363  int SP_z_struct_from_elements(CSPStructMat* S, int rows, int cols,
364  double _Complex(int i, int j),
365  const CSPOptions* opts);
366 
367 
368 
387  int SP_s_struct_mult(const CSPStructMat S, char trans, int m,
388  const float* B, int ldB,
389  float* C, int ldC);
408  int SP_d_struct_mult(const CSPStructMat S, char trans, int m,
409  const double* B, int ldB,
410  double* C, int ldC);
429  int SP_c_struct_mult(const CSPStructMat S, char trans, int m,
430  const float _Complex* B, int ldB,
431  float _Complex* C, int ldC);
450  int SP_z_struct_mult(const CSPStructMat S, char trans, int m,
451  const double _Complex* B, int ldB,
452  double _Complex* C, int ldC);
453 
454 
495 
496 
510  int SP_s_struct_solve(const CSPStructMat S, int nrhs,
511  float* B, int ldB);
525  int SP_d_struct_solve(const CSPStructMat S, int nrhs,
526  double* B, int ldB);
540  int SP_c_struct_solve(const CSPStructMat S, int nrhs,
541  float _Complex* B, int ldB);
555  int SP_z_struct_solve(const CSPStructMat S, int nrhs,
556  double _Complex* B, int ldB);
557 
558 
580  int SP_d_struct_shift(CSPStructMat S, double s);
591  int SP_c_struct_shift(CSPStructMat S, float _Complex s);
602  int SP_z_struct_shift(CSPStructMat S, double _Complex s);
603 
604 #ifdef __cplusplus
605 }
606 #endif
607 
608 #endif
void SP_s_struct_default_options(CSPOptions *opts)
void SP_s_struct_destroy(CSPStructMat *S)
int SP_d_struct_from_dense(CSPStructMat *S, int rows, int cols, const double *A, int ldA, const CSPOptions *opts)
void SP_c_struct_destroy(CSPStructMat *S)
void SP_c_struct_default_options(CSPOptions *opts)
int SP_c_struct_cols(const CSPStructMat S)
int SP_z_struct_from_dense(CSPStructMat *S, int rows, int cols, const double _Complex *A, int ldA, const CSPOptions *opts)
int SP_d_struct_rank(const CSPStructMat S)
int SP_c_struct_rows(const CSPStructMat S)
int SP_d_struct_factor(CSPStructMat S)
void SP_z_struct_destroy(CSPStructMat *S)
long long int SP_c_struct_memory(const CSPStructMat S)
int SP_s_struct_solve(const CSPStructMat S, int nrhs, float *B, int ldB)
int SP_s_struct_factor(CSPStructMat S)
int SP_d_struct_cols(const CSPStructMat S)
long long int SP_s_struct_memory(const CSPStructMat S)
int SP_c_struct_mult(const CSPStructMat S, char trans, int m, const float _Complex *B, int ldB, float _Complex *C, int ldC)
long long int SP_z_struct_memory(const CSPStructMat S)
SP_STRUCTURED_TYPE
Definition: StructuredMatrix.h:46
int SP_z_struct_cols(const CSPStructMat S)
int SP_c_struct_from_dense(CSPStructMat *S, int rows, int cols, const float _Complex *A, int ldA, const CSPOptions *opts)
int SP_s_struct_mult(const CSPStructMat S, char trans, int m, const float *B, int ldB, float *C, int ldC)
int SP_z_struct_solve(const CSPStructMat S, int nrhs, double _Complex *B, int ldB)
void SP_d_struct_destroy(CSPStructMat *S)
long long int SP_d_struct_nonzeros(const CSPStructMat S)
int SP_d_struct_shift(CSPStructMat S, double s)
int SP_d_struct_mult(const CSPStructMat S, char trans, int m, const double *B, int ldB, double *C, int ldC)
int SP_s_struct_rows(const CSPStructMat S)
int SP_z_struct_rank(const CSPStructMat S)
int SP_z_struct_rows(const CSPStructMat S)
int SP_c_struct_rank(const CSPStructMat S)
long long int SP_s_struct_nonzeros(const CSPStructMat S)
int SP_d_struct_rows(const CSPStructMat S)
long long int SP_z_struct_nonzeros(const CSPStructMat S)
int SP_c_struct_shift(CSPStructMat S, float _Complex s)
void SP_d_struct_default_options(CSPOptions *opts)
void * CSPStructMat
Type representing a structured matrix in the C interface.
Definition: StructuredMatrix.h:85
int SP_s_struct_cols(const CSPStructMat S)
int SP_d_struct_solve(const CSPStructMat S, int nrhs, double *B, int ldB)
int SP_s_struct_from_dense(CSPStructMat *S, int rows, int cols, const float *A, int ldA, const CSPOptions *opts)
int SP_c_struct_solve(const CSPStructMat S, int nrhs, float _Complex *B, int ldB)
long long int SP_d_struct_memory(const CSPStructMat S)
int SP_z_struct_factor(CSPStructMat S)
int SP_z_struct_shift(CSPStructMat S, double _Complex s)
long long int SP_c_struct_nonzeros(const CSPStructMat S)
int SP_c_struct_factor(CSPStructMat S)
int SP_s_struct_rank(const CSPStructMat S)
int SP_z_struct_mult(const CSPStructMat S, char trans, int m, const double _Complex *B, int ldB, double _Complex *C, int ldC)
void SP_z_struct_default_options(CSPOptions *opts)
int SP_s_struct_shift(CSPStructMat S, float s)
Structure containing options for structured matrix compression, to be used with the C interface.
Definition: StructuredMatrix.h:68