| 1 | //
|
|---|
| 2 | // cgsparse.h
|
|---|
| 3 | // cgnonintrusive
|
|---|
| 4 | //
|
|---|
| 5 | // Created by Sri Hari Krishna Narayanan on 11/10/15.
|
|---|
| 6 | //
|
|---|
| 7 | //
|
|---|
| 8 |
|
|---|
| 9 | #ifndef __cg__cgsparse_h
|
|---|
| 10 | #define __cg__cgsparse_h
|
|---|
| 11 |
|
|---|
| 12 | /** @brief Fully intrusive version of CSR CG algorithm. Solves Ax=b for an ensemble of A in CSR format and a single b and returns x for each ensemble member and the iteration at which convergence is reached.
|
|---|
| 13 | * @param NZ #nonzeroes in each CSR matrix.
|
|---|
| 14 | * @param row_start rows of each CSR matrix.
|
|---|
| 15 | * @param col_idx cols of each CSR matrix.
|
|---|
| 16 | * @param CSR_A values of the ensemble of CSR matrices.
|
|---|
| 17 | * @param b RHS vector.
|
|---|
| 18 | * @param n dimensions of A (same as m).
|
|---|
| 19 | * @param m dimensions of A (same as n).
|
|---|
| 20 | * @param tolerance value to which norm is tested.
|
|---|
| 21 | * @param ensemblecount number of ensembles, .
|
|---|
| 22 | * @param ensemblepolicy (allconverge=0, anyconverge=1, halfconverge=2).
|
|---|
| 23 | * @param x ensemble of output solutions.
|
|---|
| 24 | * @param converged output to report iterations at which CG converges.
|
|---|
| 25 | * @return Void.
|
|---|
| 26 | */
|
|---|
| 27 | void conjugateGradientEnsembleACSR( int NZ, int *row_start, int *col_idx, double **CSR_A, double *b, int n, int m, double tolerance, int ensemblecount, int ensemblepolicy, double **x, int *converged);
|
|---|
| 28 |
|
|---|
| 29 | /** @brief Fully intrusive version of CSR CG algorithm. Solves Ax=b for a single A in CSR format and an ensemble of b and returns x for each ensemeble member and the iteration at which convergence is reached.
|
|---|
| 30 | * @param NZ #nonzeroes in the CSR matrix.
|
|---|
| 31 | * @param row_start rows of the CSR matrix.
|
|---|
| 32 | * @param col_idx cols of the CSR matrix.
|
|---|
| 33 | * @param CSR_A values of the CSR matrix.
|
|---|
| 34 | * @param ensemble of b RHS vectors.
|
|---|
| 35 | * @param n dimensions of A (same as m).
|
|---|
| 36 | * @param m dimensions of A (same as n).
|
|---|
| 37 | * @param tolerance value to which norm is tested.
|
|---|
| 38 | * @param ensemblecount number of ensembles, .
|
|---|
| 39 | * @param ensemblepolicy (allconverge=0, anyconverge=1, halfconverge=2).
|
|---|
| 40 | * @param x ensemble of output solutions.
|
|---|
| 41 | * @param converged output to report iterations at which CG converges.
|
|---|
| 42 | * @return Void.
|
|---|
| 43 | */
|
|---|
| 44 | void conjugateGradientEnsembleBCSR(int NZ, int *row_start, int *col_idx, double *CSR_A, double **b, int n, int m, double tolerance, int ensemblecount, int ensemblepolicy, double **x, int *converged);
|
|---|
| 45 |
|
|---|
| 46 | /** @brief Generates an ensemble of CSR A matrices and solves CSR CG fully intrusively.
|
|---|
| 47 | * @param filename file containing an input A matrix (can be NULL).
|
|---|
| 48 | * @param rhsfilename file containing an input RHS (can be NULL).
|
|---|
| 49 | * @param directionfilename file containing an input direction vector (can be NULL).
|
|---|
| 50 | * @param scalingfactor value used to scale diagonal entries of A matrices of ensemble.
|
|---|
| 51 | * @param tolerance value to which norm is tested.
|
|---|
| 52 | * @param ensemblecount total number of ensembles.
|
|---|
| 53 | * @param ensemblepolicy (allconverge=0, anyconverge=1, halfconverge=2).
|
|---|
| 54 | * @param wantindependentensemble boolean to test if ensembles should be independent from each other.
|
|---|
| 55 | * @return Void.
|
|---|
| 56 | */
|
|---|
| 57 | void solveEnsembleACSR(const char * filename, const char * rhsfilename, const char * directionfilename, double scalingfactor, double tolerance, int ensemblecount, int ensemblepolicy, int wantindependentensemble);
|
|---|
| 58 |
|
|---|
| 59 | /** @brief Generates an ensemble of RHS vectors and solves CSR CG fully instrusively.
|
|---|
| 60 | * @param filename file containing an input A matrix (can be NULL).
|
|---|
| 61 | * @param rhsfilename file containing an input RHS (can be NULL).
|
|---|
| 62 | * @param directionfilename file containing an input direction vector (can be NULL).
|
|---|
| 63 | * @param scalingfactor value used to scale RHS vectors of ensemble.
|
|---|
| 64 | * @param tolerance value to which norm is tested.
|
|---|
| 65 | * @param ensemblecount total number of ensembles.
|
|---|
| 66 | * @param ensemblepolicy (allconverge=0, anyconverge=1, halfconverge=2).
|
|---|
| 67 | * @param wantindependentensemble boolean to test if ensembles should be independent from each other.
|
|---|
| 68 | * @return Void.
|
|---|
| 69 | */
|
|---|
| 70 | void solveEnsembleBCSR(const char * filename, const char * rhsfilename, const char * directionfilename, double scalingfactor, double tolerance, int ensemblecount, int ensemblepolicy, int wantindependentensemble);
|
|---|
| 71 |
|
|---|
| 72 | #endif
|
|---|