Files | |
file | bmat.h |
Class Bmat: a block sparse matrix object. | |
Classes | |
struct | sBmat |
Contains public data memebers for Bmat class. More... | |
Typedefs | |
typedef struct sBmat | Bmat |
Declaration of the Bmat class as the Bmat structure. | |
Functions | |
Bmat * | Bmat_ctor (Vmem *vmem, const char *name, int pnumB, int pnumR[MAXV], int pnumC[MAXV], MATmirror pmirror[MAXV][MAXV]) |
The block sparse matrix constructor. | |
void | Bmat_dtor (Bmat **thee) |
The block sparse matrix destructor. | |
void | Bmat_initStructure (Bmat *thee, MATformat pfrmt[MAXV][MAXV], MATsym psym[MAXV][MAXV], int pnumO[MAXV][MAXV], int *IJA[MAXV][MAXV]) |
Initialize the nonzero structure given structure information. | |
void | Bmat_copyStructure (Bmat *thee, Bmat *model) |
Copy the nonzero structure from an input model. | |
void | Bmat_killStructure (Bmat *thee) |
Kill the nonzero structure. | |
int | Bmat_numB (Bmat *thee) |
Return the number of blocks. | |
int | Bmat_numR (Bmat *thee, int p, int q) |
Return the number of rows. | |
int | Bmat_numC (Bmat *thee, int p, int q) |
Return the number of columns. | |
int | Bmat_numA (Bmat *thee, int p, int q) |
Return the number of nonzeros we actually store in a block. | |
int | Bmat_numO (Bmat *thee, int p, int q) |
Return the number of nonzeros we actually store in a block which are actually in the strict upper-triangle of the block (DRC only). | |
int | Bmat_numZ (Bmat *thee, int p, int q) |
Return the number of nonzeros we WOULD actually store in a block if we ignored symmetry and stored everything. | |
int | Bmat_numRT (Bmat *thee) |
Return the total number of rows. | |
int | Bmat_numCT (Bmat *thee) |
Return the total number of columns. | |
int | Bmat_numAT (Bmat *thee) |
Return the total number of nonzeros we are actually storing. | |
int | Bmat_numOT (Bmat *thee) |
Return the total number of nonzeros we are actually storing which are located in the strict upper-triangle. | |
int | Bmat_numZT (Bmat *thee) |
Return the total number of nonzeros we WOULD be storing if we ignored all symmetry in all blocks and stored everything. | |
MATformat | Bmat_format (Bmat *thee, int p, int q) |
Return the format of the block. | |
MATsym | Bmat_sym (Bmat *thee, int p, int q) |
Return the symmetry of the block. | |
MATstate | Bmat_state (Bmat *thee, int p, int q) |
Return the state of the block. | |
MATimpl | Bmat_impl (Bmat *thee, int p, int q) |
Return the implicitness of the block. | |
MATmirror | Bmat_mirror (Bmat *thee, int p, int q) |
Return the mirror-ness of the block. | |
int | Bmat_sizeA (Bmat *thee) |
Return the number of nonzeros in all blocks. | |
int | Bmat_sizeIJA (Bmat *thee) |
Return the numer of integer storage locations used. | |
int * | Bmat_IJA (Bmat *thee, int p, int q) |
Return the integer structure IJA. | |
int * | Bmat_IA (Bmat *thee, int p, int q) |
Return the integer structure IA. | |
int * | Bmat_JA (Bmat *thee, int p, int q) |
Return the integer structure JA. | |
double * | Bmat_A (Bmat *thee, int p, int q) |
Return the real structure A. | |
double * | Bmat_diag (Bmat *thee, int p, int q) |
Return the diagonal of A (DRC only). | |
double * | Bmat_offU (Bmat *thee, int p, int q) |
Return the strict upper triangle of A (DRC only). | |
double * | Bmat_offL (Bmat *thee, int p, int q) |
Return the strict lower triangle of A (DRC only). | |
void | Bmat_print (Bmat *thee) |
Print the prolongation matrix blocks. | |
void | Bmat_printSp (Bmat *thee, char *fname, int pflag) |
Print the prolongation matrix in MATLAB sparse form. | |
void | Bmat_printNoD (Bmat *thee) |
Print the matrix as a DENSE matrix in MATLAB format, but first zero out any rows/cols corresponding to Dirichlet boundary points. | |
void | Bmat_printSpNoD (Bmat *thee, char *fname, int pflag) |
Print the matrix as a DENSE matrix in MATLAB format, but first zero out any rows/cols corresponding to Dirichlet boundary points. | |
void | Bmat_zero (Bmat *thee) |
Clear the floating point storage for the sparse matrix. Also clear any sparse factorization storage. | |
void | Bmat_diri (Bmat *thee) |
Setup the dirichlet equations. | |
void | Bmat_set (Bmat *thee, int p, int q, int i, int j, double val) |
Set the (i,j)-th entry of the (p,q)-th block to < val >. | |
void | Bmat_addTo (Bmat *thee, int p, int q, int i, int j, double val) |
Contribute < val > to the (i,j)-th entry of the (p,q)-th block. | |
void | Bmat_galerkin (Bmat *thee, Bmat *rmat, Bmat *amat, Bmat *pmat) |
Enforce the Galerkin conditions algebraically. | |
int | Bmat_sluDirect (Bmat *thee) |
Make a decision about whether or not a sparse direct solver should be used in place of an iterative solver, based on the size of the system. | |
void | Bmat_sluCreate (Bmat *thee) |
Create the global matrix from the blocks in the modified ROW or COL storage format. This is useful for preparing a single global matrix for input to e.g. a sparse direct solver. | |
int | Bmat_sluFactor (Bmat *thee) |
Create the sparse LU factors for global matrix. | |
int | Bmat_sluSolve (Bmat *thee, int key, double *f, double *u) |
Forward/backward solve using sparse LU factors of global matrix. | |
void | Bmat_sluDestroy (Bmat *thee) |
Destroy the sparse LU factors for the system matrix. | |
void | Bmat_memChk (Bmat *thee) |
Print the exact current malloc usage. | |
Bmat * | Bmat_clone (Vmem *vmem, char *name, Bmat *X) |
Construct a clone of a Bmat with the same structure. | |
void | Bmat_copy (Bmat *Y, Bmat *X) |
Copy a block matrix. | |
void | Bmat_squeezeBRC (Bmat *thee, int key) |
Remove the boundary rows or columns from a block matrix. | |
void | Bmat_copy2 (Bmat *Y, Bmat *X) |
Copy a block matrix. | |
void | Bmat_axpy (Bmat *Y, Bmat *X, double val, int key) |
Scalar times a Bmat plus a Bmat: Y += val*X. | |
Bmat * | Bmat_ctorPoint (Bmat *P, const char *name, int *ibase, int *numR) |
Create a Bmat pointer to the tail of a Bmat. | |
void | Bmat_dtorPoint (Bmat **thee) |
The Bmat pointer destructor. | |
void | Bmat_printDiriSp (Bmat *thee, char *fname, int pflag) |
Print the Dirichlet info of a Bmat in MATLAB sparse form. | |
Mat * | Bmat_AD (Bmat *thee, int p, int q) |
Return the Mat structure AD. | |
double | Bmat_lnDet (Bmat *thee) |
Calculate the log of the determinant of a SPD Bmat matrix. | |
void | Bmat_copyBXLN (Bmat *thee, Bmat *Alink) |
Produces a Bmat copy of a BXLN. |
double* Bmat_A | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the real structure A.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
Return the Mat structure AD.
thee | Pointer to the Bmat object | |
p | index for the row | |
q | index for the column |
void Bmat_addTo | ( | Bmat * | thee, | |
int | p, | |||
int | q, | |||
int | i, | |||
int | j, | |||
double | val | |||
) |
Contribute < val > to the (i,j)-th entry of the (p,q)-th block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks | |
i | the index of the matrix | |
j | the index of the matrix | |
val | the value of the matrix element |
Scalar times a Bmat plus a Bmat: Y += val*X.
Y | The new matrix | |
X | The old matrix | |
val | the coeficient for timing X matrix | |
key | index for different X and Y matrices. |
Construct a clone of a Bmat with the same structure.
vmem | Memory management object | |
name | character string name for this matrix | |
X | The matrix which is cloned |
Copy a block matrix.
Y | The new matrix | |
X | The old matrix |
Copy a block matrix.
Y | The new matrix | |
X | The old matrix |
Produces a Bmat copy of a BXLN.
thee | Pointer to the Bmat object | |
Alink | Pointer to the Bmat object |
Copy the nonzero structure from an input model.
thee | Pointer to the block sparse matrix | |
model | an input model |
Bmat* Bmat_ctor | ( | Vmem * | vmem, | |
const char * | name, | |||
int | pnumB, | |||
int | pnumR[MAXV], | |||
int | pnumC[MAXV], | |||
MATmirror | pmirror[MAXV][MAXV] | |||
) |
The block sparse matrix constructor.
vmem | Memory management object | |
name | character string name for this matrix | |
pnumB | number of blocks | |
pnumR | num of rows in the matrix | |
pnumC | num of cols (DRC REQUIRES numC=numR) | |
pmirror | the mirror-ness of the block |
Create a Bmat pointer to the tail of a Bmat.
P | prolongation matrix maintained by aprx | |
name | character string name for the block matrix | |
ibase | pointer to size array | |
numR | num of rows in each array block |
double* Bmat_diag | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the diagonal of A (DRC only).
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
void Bmat_diri | ( | Bmat * | thee | ) |
Setup the dirichlet equations.
thee | Pointer to the block sparse matrix |
void Bmat_dtor | ( | Bmat ** | thee | ) |
The block sparse matrix destructor.
thee | Pointer to the block sparse matrix |
void Bmat_dtorPoint | ( | Bmat ** | thee | ) |
The Bmat pointer destructor.
thee | Pointer to Pointer of the Bmat object |
Return the format of the block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
Enforce the Galerkin conditions algebraically.
thee | Pointer to the block sparse matrix | |
rmat | R matrix which is stored column-wise (ROW-format) | |
amat | A matrix which is stored in one of three forms, namely, either row-wise (ROW), col-wise (COL), or by diagonal followed by upper-triangle row-wise and then by lower triangle columne-wise (DRC). | |
pmat | P matrix which is stored row-wise (ROW-format) |
int* Bmat_IA | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the integer structure IA.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int* Bmat_IJA | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the integer structure IJA.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
Return the implicitness of the block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
void Bmat_initStructure | ( | Bmat * | thee, | |
MATformat | pfrmt[MAXV][MAXV], | |||
MATsym | psym[MAXV][MAXV], | |||
int | pnumO[MAXV][MAXV], | |||
int * | IJA[MAXV][MAXV] | |||
) |
Initialize the nonzero structure given structure information.
thee | Pointer to the block sparse matrix | |
pfrmt | format types of the block sparse matrix | |
psym | symmetric types of the block sparse matrix | |
pnumO | num of nonzeros we are actually storing in the strict upper-triangle of matrix. (DRC only) | |
IJA | integer structure [ IA ; JA ] |
int* Bmat_JA | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the integer structure JA.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
void Bmat_killStructure | ( | Bmat * | thee | ) |
Kill the nonzero structure.
thee | Pointer to the block sparse matrix |
double Bmat_lnDet | ( | Bmat * | thee | ) |
Calculate the log of the determinant of a SPD Bmat matrix.
thee | Pointer to the Bmat object |
void Bmat_memChk | ( | Bmat * | thee | ) |
Print the exact current malloc usage.
thee | Pointer to the block sparse matrix |
Return the mirror-ness of the block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int Bmat_numA | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the number of nonzeros we actually store in a block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int Bmat_numAT | ( | Bmat * | thee | ) |
Return the total number of nonzeros we are actually storing.
thee | Pointer to the block sparse matrix |
int Bmat_numB | ( | Bmat * | thee | ) |
Return the number of blocks.
thee | Pointer to the block sparse matrix |
int Bmat_numC | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the number of columns.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int Bmat_numCT | ( | Bmat * | thee | ) |
Return the total number of columns.
thee | Pointer to the block sparse matrix |
int Bmat_numO | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the number of nonzeros we actually store in a block which are actually in the strict upper-triangle of the block (DRC only).
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int Bmat_numOT | ( | Bmat * | thee | ) |
Return the total number of nonzeros we are actually storing which are located in the strict upper-triangle.
thee | Pointer to the block sparse matrix |
int Bmat_numR | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the number of rows.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int Bmat_numRT | ( | Bmat * | thee | ) |
Return the total number of rows.
thee | Pointer to the block sparse matrix |
int Bmat_numZ | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the number of nonzeros we WOULD actually store in a block if we ignored symmetry and stored everything.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
int Bmat_numZT | ( | Bmat * | thee | ) |
Return the total number of nonzeros we WOULD be storing if we ignored all symmetry in all blocks and stored everything.
thee | Pointer to the block sparse matrix |
double* Bmat_offL | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the strict lower triangle of A (DRC only).
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
double* Bmat_offU | ( | Bmat * | thee, | |
int | p, | |||
int | q | |||
) |
Return the strict upper triangle of A (DRC only).
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
void Bmat_print | ( | Bmat * | thee | ) |
Print the prolongation matrix blocks.
thee | Pointer to the block sparse matrix |
void Bmat_printDiriSp | ( | Bmat * | thee, | |
char * | fname, | |||
int | pflag | |||
) |
Print the Dirichlet info of a Bmat in MATLAB sparse form.
thee | Pointer to the Bmat object | |
fname | character string name for the block matrix | |
pflag | index for write/append |
void Bmat_printNoD | ( | Bmat * | thee | ) |
Print the matrix as a DENSE matrix in MATLAB format, but first zero out any rows/cols corresponding to Dirichlet boundary points.
thee | Pointer to the block sparse matrix |
void Bmat_printSp | ( | Bmat * | thee, | |
char * | fname, | |||
int | pflag | |||
) |
Print the prolongation matrix in MATLAB sparse form.
thee | Pointer to the block sparse matrix | |
fname | output file/buff/unix/inet name | |
pflag | flag==0 ==> write, flag==1 ==> append |
void Bmat_printSpNoD | ( | Bmat * | thee, | |
char * | fname, | |||
int | pflag | |||
) |
Print the matrix as a DENSE matrix in MATLAB format, but first zero out any rows/cols corresponding to Dirichlet boundary points.
thee | Pointer to the block sparse matrix | |
fname | output file/buff/unix/inet name | |
pflag | index for write/append |
void Bmat_set | ( | Bmat * | thee, | |
int | p, | |||
int | q, | |||
int | i, | |||
int | j, | |||
double | val | |||
) |
Set the (i,j)-th entry of the (p,q)-th block to < val >.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks | |
i | the index of the matrix | |
j | the index of the matrix | |
val | the value of the matrix element |
int Bmat_sizeA | ( | Bmat * | thee | ) |
Return the number of nonzeros in all blocks.
thee | Pointer to the block sparse matrix |
int Bmat_sizeIJA | ( | Bmat * | thee | ) |
Return the numer of integer storage locations used.
thee | Pointer to the block sparse matrix |
void Bmat_sluCreate | ( | Bmat * | thee | ) |
Create the global matrix from the blocks in the modified ROW or COL storage format. This is useful for preparing a single global matrix for input to e.g. a sparse direct solver.
thee | Pointer to the block sparse matrix |
void Bmat_sluDestroy | ( | Bmat * | thee | ) |
Destroy the sparse LU factors for the system matrix.
thee | Pointer to the block sparse matrix |
int Bmat_sluDirect | ( | Bmat * | thee | ) |
Make a decision about whether or not a sparse direct solver should be used in place of an iterative solver, based on the size of the system.
thee | Pointer to the block sparse matrix |
int Bmat_sluFactor | ( | Bmat * | thee | ) |
Create the sparse LU factors for global matrix.
thee | Pointer to the block sparse matrix |
int Bmat_sluSolve | ( | Bmat * | thee, | |
int | key, | |||
double * | f, | |||
double * | u | |||
) |
Forward/backward solve using sparse LU factors of global matrix.
thee | Pointer to the block sparse matrix | |
key | index for choosing NOTRANS or TRANS | |
f | the number of right-hand sides | |
u | solution |
void Bmat_squeezeBRC | ( | Bmat * | thee, | |
int | key | |||
) |
Remove the boundary rows or columns from a block matrix.
thee | Pointer to the block sparse matrix | |
key | index for removing the boundary rows or columns from a matrix |
Return the state of the block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
Return the symmetry of the block.
thee | Pointer to the block sparse matrix | |
p | the index of the blocks | |
q | the index of the blocks |
void Bmat_zero | ( | Bmat * | thee | ) |
Clear the floating point storage for the sparse matrix. Also clear any sparse factorization storage.
thee | Pointer to the block sparse matrix |