Contains the structured matrix C interfaces, see StructuredMatrix.hpp for the C++ interface. More...
#include <stdint.h>#include <complex.h>#include "StrumpackConfig.hpp"
Go to the source code of this file.
| Classes | |
| struct | CSPOptions | 
| Structure containing options for structured matrix compression, to be used with the C interface.  More... | |
| Typedefs | |
| typedef struct CSPOptions | CSPOptions | 
| typedef void * | CSPStructMat | 
| Type representing a structured matrix in the C interface.  More... | |
| Enumerations | |
| enum | SP_STRUCTURED_TYPE { SP_TYPE_HSS = 0 , SP_TYPE_BLR , SP_TYPE_HODLR , SP_TYPE_HODBF , SP_TYPE_BUTTERFLY , SP_TYPE_LR , SP_TYPE_LOSSY , SP_TYPE_LOSSLESS } | 
| Functions | |
| void | SP_s_struct_default_options (CSPOptions *opts) | 
| void | SP_d_struct_default_options (CSPOptions *opts) | 
| void | SP_c_struct_default_options (CSPOptions *opts) | 
| void | SP_z_struct_default_options (CSPOptions *opts) | 
| void | SP_s_struct_destroy (CSPStructMat *S) | 
| void | SP_d_struct_destroy (CSPStructMat *S) | 
| void | SP_c_struct_destroy (CSPStructMat *S) | 
| void | SP_z_struct_destroy (CSPStructMat *S) | 
| int | SP_s_struct_rows (const CSPStructMat S) | 
| int | SP_d_struct_rows (const CSPStructMat S) | 
| int | SP_c_struct_rows (const CSPStructMat S) | 
| int | SP_z_struct_rows (const CSPStructMat S) | 
| int | SP_s_struct_cols (const CSPStructMat S) | 
| int | SP_d_struct_cols (const CSPStructMat S) | 
| int | SP_c_struct_cols (const CSPStructMat S) | 
| int | SP_z_struct_cols (const CSPStructMat S) | 
| long long int | SP_s_struct_memory (const CSPStructMat S) | 
| long long int | SP_d_struct_memory (const CSPStructMat S) | 
| long long int | SP_c_struct_memory (const CSPStructMat S) | 
| long long int | SP_z_struct_memory (const CSPStructMat S) | 
| long long int | SP_s_struct_nonzeros (const CSPStructMat S) | 
| long long int | SP_d_struct_nonzeros (const CSPStructMat S) | 
| long long int | SP_c_struct_nonzeros (const CSPStructMat S) | 
| long long int | SP_z_struct_nonzeros (const CSPStructMat S) | 
| int | SP_s_struct_rank (const CSPStructMat S) | 
| int | SP_d_struct_rank (const CSPStructMat S) | 
| int | SP_c_struct_rank (const CSPStructMat S) | 
| int | SP_z_struct_rank (const CSPStructMat S) | 
| int | SP_s_struct_from_dense (CSPStructMat *S, int rows, int cols, const float *A, int ldA, const CSPOptions *opts) | 
| int | SP_d_struct_from_dense (CSPStructMat *S, int rows, int cols, const double *A, int ldA, const CSPOptions *opts) | 
| int | SP_c_struct_from_dense (CSPStructMat *S, int rows, int cols, const float _Complex *A, int ldA, const CSPOptions *opts) | 
| int | SP_z_struct_from_dense (CSPStructMat *S, int rows, int cols, const double _Complex *A, int ldA, const CSPOptions *opts) | 
| int | SP_s_struct_from_elements (CSPStructMat *S, int rows, int cols, float(int i, int j), const CSPOptions *opts) | 
| int | SP_d_struct_from_elements (CSPStructMat *S, int rows, int cols, double(int i, int j), const CSPOptions *opts) | 
| int | SP_c_struct_from_elements (CSPStructMat *S, int rows, int cols, float _Complex(int i, int j), const CSPOptions *opts) | 
| int | SP_z_struct_from_elements (CSPStructMat *S, int rows, int cols, double _Complex(int i, int j), 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_d_struct_mult (const CSPStructMat S, char trans, int m, const double *B, int ldB, double *C, int ldC) | 
| int | SP_c_struct_mult (const CSPStructMat S, char trans, int m, const float _Complex *B, int ldB, float _Complex *C, int ldC) | 
| int | SP_z_struct_mult (const CSPStructMat S, char trans, int m, const double _Complex *B, int ldB, double _Complex *C, int ldC) | 
| int | SP_s_struct_factor (CSPStructMat S) | 
| int | SP_d_struct_factor (CSPStructMat S) | 
| int | SP_c_struct_factor (CSPStructMat S) | 
| int | SP_z_struct_factor (CSPStructMat S) | 
| int | SP_s_struct_solve (const CSPStructMat S, int nrhs, float *B, int ldB) | 
| int | SP_d_struct_solve (const CSPStructMat S, int nrhs, double *B, int ldB) | 
| int | SP_c_struct_solve (const CSPStructMat S, int nrhs, float _Complex *B, int ldB) | 
| int | SP_z_struct_solve (const CSPStructMat S, int nrhs, double _Complex *B, int ldB) | 
| int | SP_s_struct_shift (CSPStructMat S, float s) | 
| int | SP_d_struct_shift (CSPStructMat S, double s) | 
| int | SP_c_struct_shift (CSPStructMat S, float _Complex s) | 
| int | SP_z_struct_shift (CSPStructMat S, double _Complex s) | 
Contains the structured matrix C interfaces, see StructuredMatrix.hpp for the C++ interface.
| typedef void* CSPStructMat | 
Type representing a structured matrix in the C interface.
See any of the SP_x_struct... routines. Internally this will be represented as a structured::StructuredMatrix object (implemented in C++).
| enum SP_STRUCTURED_TYPE | 
Enumeration of possible structured matrix types. See structured::Type
| int SP_c_struct_cols | ( | const CSPStructMat | S | ) | 
Return number of cols in the structured matrix.
| void SP_c_struct_default_options | ( | CSPOptions * | opts | ) | 
Fill the options structure with default values. Use this for single precision, complex.
| opts | Pointer to CSPOptions structure | 
| void SP_c_struct_destroy | ( | CSPStructMat * | S | ) | 
Destroy the structured matrix. Use this for a structured matrix created with one of the SP_c_struct_... routines, i.e., single precision, complex.
| S | Pointer to CSPStructMat object. | 
| int SP_c_struct_factor | ( | CSPStructMat | S | ) | 
Compute a factorization of the structured matrix. Factors are stored internally. This needs to be called before calling SP_c_struct_solve, and after constructing the structured matrix.
| S | structured matrix | 
| int SP_c_struct_from_dense | ( | CSPStructMat * | S, | 
| int | rows, | ||
| int | cols, | ||
| const float _Complex * | A, | ||
| int | ldA, | ||
| const CSPOptions * | opts | ||
| ) | 
Construct a structured matrix from a dense (column major) matrix. Use this for single precision, complex.
| S | Pointer to CSPStructMat object, which will be constructed. | 
| rows | Number of rows in A | 
| cols | Number of columns in A | 
| A | Pointer to data of A, column major | 
| ldA | leading dimension of A | 
| opts | Options structure, needs to be initialized by the user. | 
| long long int SP_c_struct_memory | ( | const CSPStructMat | S | ) | 
Return the total amount of memory used by this matrix, in bytes.
| int SP_c_struct_mult | ( | const CSPStructMat | S, | 
| char | trans, | ||
| int | m, | ||
| const float _Complex * | B, | ||
| int | ldB, | ||
| float _Complex * | C, | ||
| int | ldC | ||
| ) | 
Multiply a structured matrix with a dense matrix (or vector):
     C = S*B   if trans == 'N' or 'n'
     C = S^T*B if trans == 'T' or 't'
     C = S^C*B if trans == 'C' or 'c'
C should have rows(S) rows if trans == 'N'/'n', else cols(S). B should have cols(S) rows if trans == 'N'/'n', else rows(S).
| S | structured matrix | 
| trans | (conjugate-)transpose of S? | 
| m | number of columns in B and C | 
| B | pointer to data of B (column major) | 
| ldB | leading dimension for B | 
| C | pointer to matrix C (column major) | 
| ldC | leading dimension for C | 
| long long int SP_c_struct_nonzeros | ( | const CSPStructMat | S | ) | 
Return the total number of nonzeros stored by this matrix.
| int SP_c_struct_rank | ( | const CSPStructMat | S | ) | 
Return the maximum rank of this matrix over all low-rank compressed blocks.
| int SP_c_struct_rows | ( | const CSPStructMat | S | ) | 
Return number of rows in the structured matrix.
| int SP_c_struct_shift | ( | CSPStructMat | S, | 
| float _Complex | s | ||
| ) | 
Apply a shift to the diagonal of this matrix. Ie, S += s*I, with I the identity matrix. If this is called after calling factor, then the factors are not updated. To solve a linear system with the shifted matrix, you need to call factor again.
| S | structured matrix | 
| s | Shift to be applied to the diagonal. | 
| int SP_c_struct_solve | ( | const CSPStructMat | S, | 
| int | nrhs, | ||
| float _Complex * | B, | ||
| int | ldB | ||
| ) | 
Solve a system of linear equations with a structured matrix, with possibly multiple right-hand sides (column major). The solution overwrites the right-hand side. This should be called after SP_c_struct_factor. This can be called multiple times.
| S | structured matrix | 
| nrhs | number of right-hand sides, columns in B | 
| B | right-hand side, will be overwritten by the solution | 
| ldB | leading dimension of B | 
| int SP_d_struct_cols | ( | const CSPStructMat | S | ) | 
Return number of cols in the structured matrix.
| void SP_d_struct_default_options | ( | CSPOptions * | opts | ) | 
Fill the options structure with default values. Use this for double precision, real.
| opts | Pointer to CSPOptions structure | 
| void SP_d_struct_destroy | ( | CSPStructMat * | S | ) | 
Destroy the structured matrix. Use this for a structured matrix created with one of the SP_d_struct_... routines, i.e., double precision, real.
| S | Pointer to CSPStructMat object. | 
| int SP_d_struct_factor | ( | CSPStructMat | S | ) | 
Compute a factorization of the structured matrix. Factors are stored internally. This needs to be called before calling SP_d_struct_solve, and after constructing the structured matrix.
| S | structured matrix | 
| int SP_d_struct_from_dense | ( | CSPStructMat * | S, | 
| int | rows, | ||
| int | cols, | ||
| const double * | A, | ||
| int | ldA, | ||
| const CSPOptions * | opts | ||
| ) | 
Construct a structured matrix from a dense (column major) matrix. Use this for double precision, real.
| S | Pointer to CSPStructMat object, which will be constructed. | 
| rows | Number of rows in A | 
| cols | Number of columns in A | 
| A | Pointer to data of A, column major | 
| ldA | leading dimension of A | 
| opts | Options structure, needs to be initialized by the user. | 
| long long int SP_d_struct_memory | ( | const CSPStructMat | S | ) | 
Return the total amount of memory used by this matrix, in bytes.
| int SP_d_struct_mult | ( | const CSPStructMat | S, | 
| char | trans, | ||
| int | m, | ||
| const double * | B, | ||
| int | ldB, | ||
| double * | C, | ||
| int | ldC | ||
| ) | 
Multiply a structured matrix with a dense matrix (or vector):
     C = S*B   if trans == 'N' or 'n'
     C = S^T*B if trans == 'T' or 't'
     C = S^C*B if trans == 'C' or 'c'
C should have rows(S) rows if trans == 'N'/'n', else cols(S). B should have cols(S) rows if trans == 'N'/'n', else rows(S).
| S | structured matrix | 
| trans | (conjugate-)transpose of S? | 
| m | number of columns in B and C | 
| B | pointer to data of B (column major) | 
| ldB | leading dimension for B | 
| C | pointer to matrix C (column major) | 
| ldC | leading dimension for C | 
| long long int SP_d_struct_nonzeros | ( | const CSPStructMat | S | ) | 
Return the total number of nonzeros stored by this matrix.
| int SP_d_struct_rank | ( | const CSPStructMat | S | ) | 
Return the maximum rank of this matrix over all low-rank compressed blocks.
| int SP_d_struct_rows | ( | const CSPStructMat | S | ) | 
Return number of rows in the structured matrix.
| int SP_d_struct_shift | ( | CSPStructMat | S, | 
| double | s | ||
| ) | 
Apply a shift to the diagonal of this matrix. Ie, S += s*I, with I the identity matrix. If this is called after calling factor, then the factors are not updated. To solve a linear system with the shifted matrix, you need to call factor again.
| S | structured matrix | 
| s | Shift to be applied to the diagonal. | 
| int SP_d_struct_solve | ( | const CSPStructMat | S, | 
| int | nrhs, | ||
| double * | B, | ||
| int | ldB | ||
| ) | 
Solve a system of linear equations with a structured matrix, with possibly multiple right-hand sides (column major). The solution overwrites the right-hand side. This should be called after SP_d_struct_factor. This can be called multiple times.
| S | structured matrix | 
| nrhs | number of right-hand sides, columns in B | 
| B | right-hand side, will be overwritten by the solution | 
| ldB | leading dimension of B | 
| int SP_s_struct_cols | ( | const CSPStructMat | S | ) | 
Return number of cols in the structured matrix.
| void SP_s_struct_default_options | ( | CSPOptions * | opts | ) | 
Fill the options structure with default values. Use this for single precision, real.
| opts | Pointer to CSPOptions structure | 
| void SP_s_struct_destroy | ( | CSPStructMat * | S | ) | 
Destroy the structured matrix. Use this for a structured matrix created with one of the SP_s_struct_... routines, i.e., single precision, real.
| S | Pointer to CSPStructMat object. | 
| int SP_s_struct_factor | ( | CSPStructMat | S | ) | 
Compute a factorization of the structured matrix. Factors are stored internally. This needs to be called before calling SP_s_struct_solve, and after constructing the structured matrix.
| S | structured matrix | 
| int SP_s_struct_from_dense | ( | CSPStructMat * | S, | 
| int | rows, | ||
| int | cols, | ||
| const float * | A, | ||
| int | ldA, | ||
| const CSPOptions * | opts | ||
| ) | 
Construct a structured matrix from a dense (column major) matrix. Use this for single precision, real.
| S | Pointer to CSPStructMat object, which will be constructed. | 
| rows | Number of rows in A | 
| cols | Number of columns in A | 
| A | Pointer to data of A, column major | 
| ldA | leading dimension of A | 
| opts | Options structure, needs to be initialized by the user. | 
| long long int SP_s_struct_memory | ( | const CSPStructMat | S | ) | 
Return the total amount of memory used by this matrix, in bytes.
| int SP_s_struct_mult | ( | const CSPStructMat | S, | 
| char | trans, | ||
| int | m, | ||
| const float * | B, | ||
| int | ldB, | ||
| float * | C, | ||
| int | ldC | ||
| ) | 
Multiply a structured matrix with a dense matrix (or vector):
     C = S*B   if trans == 'N' or 'n'
     C = S^T*B if trans == 'T' or 't'
     C = S^C*B if trans == 'C' or 'c'
C should have rows(S) rows if trans == 'N'/'n', else cols(S). B should have cols(S) rows if trans == 'N'/'n', else rows(S).
| S | structured matrix | 
| trans | (conjugate-)transpose of S? | 
| m | number of columns in B and C | 
| B | pointer to data of B (column major) | 
| ldB | leading dimension for B | 
| C | pointer to matrix C (column major) | 
| ldC | leading dimension for C | 
| long long int SP_s_struct_nonzeros | ( | const CSPStructMat | S | ) | 
Return the total number of nonzeros stored by this matrix.
| int SP_s_struct_rank | ( | const CSPStructMat | S | ) | 
Return the maximum rank of this matrix over all low-rank compressed blocks.
| int SP_s_struct_rows | ( | const CSPStructMat | S | ) | 
Return number of rows in the structured matrix.
| int SP_s_struct_shift | ( | CSPStructMat | S, | 
| float | s | ||
| ) | 
Apply a shift to the diagonal of this matrix. Ie, S += s*I, with I the identity matrix. If this is called after calling factor, then the factors are not updated. To solve a linear system with the shifted matrix, you need to call factor again.
| S | structured matrix | 
| s | Shift to be applied to the diagonal. | 
| int SP_s_struct_solve | ( | const CSPStructMat | S, | 
| int | nrhs, | ||
| float * | B, | ||
| int | ldB | ||
| ) | 
Solve a system of linear equations with a structured matrix, with possibly multiple right-hand sides (column major). The solution overwrites the right-hand side. This should be called after SP_s_struct_factor. This can be called multiple times.
| S | structured matrix | 
| nrhs | number of right-hand sides, columns in B | 
| B | right-hand side, will be overwritten by the solution | 
| ldB | leading dimension of B | 
| int SP_z_struct_cols | ( | const CSPStructMat | S | ) | 
Return number of cols in the structured matrix.
| void SP_z_struct_default_options | ( | CSPOptions * | opts | ) | 
Fill the options structure with default values. Use this for double precision, complex.
| opts | Pointer to CSPOptions structure | 
| void SP_z_struct_destroy | ( | CSPStructMat * | S | ) | 
Destroy the structured matrix. Use this for a structured matrix created with one of the SP_z_struct_... routines, i.e., double precision, complex.
| S | Pointer to CSPStructMat object. | 
| int SP_z_struct_factor | ( | CSPStructMat | S | ) | 
Compute a factorization of the structured matrix. Factors are stored internally. This needs to be called before calling SP_z_struct_solve, and after constructing the structured matrix.
| S | structured matrix | 
| int SP_z_struct_from_dense | ( | CSPStructMat * | S, | 
| int | rows, | ||
| int | cols, | ||
| const double _Complex * | A, | ||
| int | ldA, | ||
| const CSPOptions * | opts | ||
| ) | 
Construct a structured matrix from a dense (column major) matrix. Use this for double precision, complex.
| S | Pointer to CSPStructMat object, which will be constructed. | 
| rows | Number of rows in A | 
| cols | Number of columns in A | 
| A | Pointer to data of A, column major | 
| ldA | leading dimension of A | 
| opts | Options structure, needs to be initialized by the user. | 
| long long int SP_z_struct_memory | ( | const CSPStructMat | S | ) | 
Return the total amount of memory used by this matrix, in bytes.
| int SP_z_struct_mult | ( | const CSPStructMat | S, | 
| char | trans, | ||
| int | m, | ||
| const double _Complex * | B, | ||
| int | ldB, | ||
| double _Complex * | C, | ||
| int | ldC | ||
| ) | 
Multiply a structured matrix with a dense matrix (or vector):
     C = S*B   if trans == 'N' or 'n'
     C = S^T*B if trans == 'T' or 't'
     C = S^C*B if trans == 'C' or 'c'
C should have rows(S) rows if trans == 'N'/'n', else cols(S). B should have cols(S) rows if trans == 'N'/'n', else rows(S).
| S | structured matrix | 
| trans | (conjugate-)transpose of S? | 
| m | number of columns in B and C | 
| B | pointer to data of B (column major) | 
| ldB | leading dimension for B | 
| C | pointer to matrix C (column major) | 
| ldC | leading dimension for C | 
| long long int SP_z_struct_nonzeros | ( | const CSPStructMat | S | ) | 
Return the total number of nonzeros stored by this matrix.
| int SP_z_struct_rank | ( | const CSPStructMat | S | ) | 
Return the maximum rank of this matrix over all low-rank compressed blocks.
| int SP_z_struct_rows | ( | const CSPStructMat | S | ) | 
Return number of rows in the structured matrix.
| int SP_z_struct_shift | ( | CSPStructMat | S, | 
| double _Complex | s | ||
| ) | 
Apply a shift to the diagonal of this matrix. Ie, S += s*I, with I the identity matrix. If this is called after calling factor, then the factors are not updated. To solve a linear system with the shifted matrix, you need to call factor again.
| S | structured matrix | 
| s | Shift to be applied to the diagonal. | 
| int SP_z_struct_solve | ( | const CSPStructMat | S, | 
| int | nrhs, | ||
| double _Complex * | B, | ||
| int | ldB | ||
| ) | 
Solve a system of linear equations with a structured matrix, with possibly multiple right-hand sides (column major). The solution overwrites the right-hand side. This should be called after SP_z_struct_factor. This can be called multiple times.
| S | structured matrix | 
| nrhs | number of right-hand sides, columns in B | 
| B | right-hand side, will be overwritten by the solution | 
| ldB | leading dimension of B |