hp2FEM
0.1
|
Public Member Functions | |
SymmetricSparse () | |
Constructor without parameters. | |
SymmetricSparse (long MatrixOrder, long *Diagonal, long *Columns, double InitValue=0.0) | |
Constructor with parameters. | |
SymmetricSparse (long MatrixOrder, long *Diagonal, long *Columns, double *Elements) | |
Constructor with parameters. | |
SymmetricSparse (FILE *File) | |
Constructor. | |
SymmetricSparse (SymmetricSparse &Instance) | |
Copy constructor. | |
~SymmetricSparse () | |
Destructor. | |
SymmetricSparse & | operator= (SymmetricSparse &Instance) |
Assignment operator '='. | |
SymmetricSparse & | Equal (SymmetricSparse &Instance) |
This method assigns a matrix to another. | |
operator SSM_T *const () | |
Convert 'SymmetricSparse' to 'double*'. | |
operator long *const () | |
Convert 'SymmetricSparse' to 'long*'. | |
double & | operator() (long Row, long Col) |
Overlap Opertor '()'. | |
double & | GetElement (unsigned long Row, unsigned long Column) |
Returns the element value and checks if it belongs to matrix. | |
void | SetOrder (unsigned long MatrixOrder, long *Diagonal=NULL, double Value=0.0) |
Initializes the matrix order through the elements number per row. | |
void | SetOrder (unsigned long MatrixOrder, long NumberElements, double Value=0.0) |
Initializes the matrix order and the elements number of the matrix. | |
unsigned long | GetOrder () |
Returns the matrix order. | |
unsigned long | GetNumberElements () |
Returns the elements number of the matrix. | |
long | GetAverElementsLine () |
Returns average elements number per row. | |
void | GetMaxMinDiagElems (double &MinDiagValue, double &MaxDiagValue) |
void | GetTopology (long &MatrixOrder, long &NumberElements, long &MaxNumberElLine, long &MinNumberElLine, long &AverNumberElLine) |
long | SizeOf () |
Returns the bytes number occupied by the matrix. | |
void | Reset (double Value=0.0) |
Reinitializes the elements with the value contained in the "Value" parameter. | |
void | Insert (SymmetricMatrix &SubMatrix, long *LineCol) |
Inserts a sparse matrix from the rows and columns given in the 'LineCol' vector. | |
void | Insert (SymmetricMatrix &SubMatrix, long *LineCol, unsigned long InitLineCol) |
Inserts a sparse matrix from the rows and columns given in the 'LineCol' vector. | |
void | Multiplicate (double *X, double *Y) |
Multiplies matrix by a vector: x = A.y. | |
void | Multiplicate (double scalar) |
Multiplies matrix by a scalas: A = A*scalar. | |
void | Add (SymmetricSparse &A, SymmetricSparse &B) |
Performs the addition between two symmetric sparse matrices. this = A + B. | |
void | Add (SymmetricSparse &A) |
Performs the addition between two symmetric sparse matrices. this = this + A. | |
void | Save (FILE *File) |
Saves the matrix in a binary file. | |
void | Save (char *TabName, int Version, char *Filename) |
Saves the matrix in the 'acdp' database. | |
void | Restore (FILE *File) |
Reads the matrix from a binary file. | |
void | Restore (char *TabName, int Version, char *Filename) |
Reads the matrix from the 'acdp' database. | |
void | Print (FILE *File, int Mant, int Dec) |
Prints the matrix in a ASCII file in the suitable format for the SymmetricSparse(FILE*) constructor. | |
void | Print (FILE *File=stdout, const char *Message="", int NumMaxCols=5, int Mant=14, int Dec=7) |
Prints the matrix in ASCII format. | |
void | PrintTopology (FILE *File) |
Prints the matrix topology. | |
void | Free () |
Frees memory area allocated by the sparse matrix. | |
void | GaussSolver (double *U, double *B, double Precision) |
Method to solve system of linear equations. | |
void | GaussSolver (double Precision=1e-12) |
Method to solve system of linear equations. | |
void | GaussSolver (double *U, double *B) |
Method to solve system of linear equations. | |
long | Jacobi (double *U, double *B, unsigned long MaxNumberIter, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Method to solve system of linear equations. | |
long | Jacobi (double *U, double *B, unsigned long MaxNumberIter) |
Method to solve system of linear equations. | |
long | GaussSeidel (double *U, double *B, unsigned long MaxNumberIter, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Method to solve system of linear equations. | |
long | GaussSeidel (double *U, double *B, unsigned long NumberIter) |
Method to solve system of linear equations. | |
long | SOR (double *U, double *B, long MaxNumberIter, double &NormRes, double Precision=1e-4, double Omega=1.81, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Method to solve system of linear equations. | |
long | CG (double *U, double *B, long MaxNumberIter, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Method to solve system of linear equations. | |
long | CGDiagonal (double *U, double *B, long MaxNumberIter, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Method to solve system of linear equations. | |
long | CGPreConditionated (double *U, double *B, long MaxNumberIter, double &NormRes, double Precision=1e-4, double Omega=1.81, PreMatrix_E PreMatrix=SGS, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Method to solve system of linear equations. | |
Protected Member Functions | |
void | FreeAuxVectors () |
Deallocates memory area used by auxiliary vectors. | |
void | AllocDiag (long *Diagonal=NULL) |
Allocates vector with the height of the diagonal elements . | |
void | Alloc (double InitValue=0.0) |
Allocates memory area to the sparse matrix. | |
unsigned long | GetNumElLine (long Lin) |
Returns elements number of the row. | |
void | TopologyEvaluation () |
Calculates the maximum and minimum number of elements for each row. | |
void | MaxMinDiagEvaluation () |
Returns the maximum and minimum absolute value of the diagonal. | |
int | ConvCriteria (double *U, double *Un, double *b, double Prec, double Normb, ConvCriterion_E Crit, NormDS_E Norm, double &NormRes) |
Checks the convergence of iterative methods by criterias following: | |
void | prodauxsk (double *X, double *Y, double cte) |
Auxiliary method used in the conjugate gradient method. | |
void | bcksbstsk (double *U, double *B, double omega) |
Auxiliary method used in the conjugate gradient method. | |
void | fwdsbstsk (double *U, double *B, double omega) |
Auxiliary method used in the conjugate gradient method. | |
void | prodfx (double *Z, double *X, double Omega) |
Auxiliary method used in the conjugate gradient method. | |
void | prauxsk (double *U, double *B) |
Auxiliary method used in the conjugate gradient method. | |
double | norinfv (double *u, long dim) |
Calculates the infinity norm of the array. | |
double | scalv (double *x, double *y, unsigned long dim) |
Calculates the product scalar between two vectors. | |
double | normaev (double *u, long dim) |
Calculate the euclidean norm of a vector. | |
Protected Attributes | |
unsigned long | PolyOrder |
The matrix order. | |
unsigned long | MaxNumElLine |
Maximum number of the elements by row. | |
unsigned long | MinNumElLine |
Minimum number of the elements by row. | |
long * | Pos |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method. | |
long * | Diag |
Pointers for beginning of rows. | |
double * | d |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method. | |
double * | f |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method. | |
double * | g |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method. | |
double * | h |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method. | |
SSM_T * | SSMatrix |
Matrix elements stored as a array. | |
double | MaxDiagElem |
Maximum value of the diagonal. | |
double | MinDiagElem |
Minimum value of the diagonal. | |
Static Protected Attributes | |
static double | Zero |
Coefficient null or nonexistent. |
SymmetricSparse::SymmetricSparse | ( | long | MatrixOrder, |
long * | Diagonal, | ||
long * | Columns, | ||
double | InitValue = 0.0 |
||
) |
Constructor with parameters.
Initializes attributes, allocates memory area to the matrix, initializes the columns with values in "Columns" and the elements with value in "InitValue".
[in] | MatrixOrder | - The order matrix. |
[in] | Diagonal | - Elements of the diagonal. |
[in] | Columns. | |
[in] | InitValue | - The initial value to the matrix. |
SymmetricSparse::SymmetricSparse | ( | long | MatrixOrder, |
long * | Diagonal, | ||
long * | Columns, | ||
double * | Elements | ||
) |
Constructor with parameters.
Initializes attributes, allocates memory area to the matrix, Initializes columns with values in "Columns" and elements with values in "Elements".
[in] | MatrixOrder | - The order matrix. |
[in] | Diagonal | - Elements of the diagonal. |
[in] | Columns. | |
[in] | Elements. |
SymmetricSparse::SymmetricSparse | ( | FILE * | File | ) |
Constructor.
Reads from a ASCII file with the elements of the matrix. The ASCII file contains the matrix order (the long type), the diagonal (a vector the long type) and elements of matrix (vector the SSM_T type).
[in] | File | - A binary file. |
SymmetricSparse::SymmetricSparse | ( | SymmetricSparse & | Instance | ) |
Copy constructor.
[in] | Instance | - symmetric sparse type. |
void SymmetricSparse::Add | ( | SymmetricSparse & | A, |
SymmetricSparse & | B | ||
) |
Performs the addition between two symmetric sparse matrices. this = A + B.
[in] | A | - Symmetric sparse matrix; |
[in] | B | - Symmetric sparse matrix; |
void SymmetricSparse::Add | ( | SymmetricSparse & | A | ) |
Performs the addition between two symmetric sparse matrices. this = this + A.
[in] | A | - Symmetric sparse matrix; |
void SymmetricSparse::Alloc | ( | double | InitValue = 0.0 | ) | [protected] |
Allocates memory area to the sparse matrix.
[in] | InitValue | - Value that will be assigned for all elements of matrix. |
void SymmetricSparse::AllocDiag | ( | long * | Diagonal = NULL | ) | [protected] |
Allocates vector with the height of the diagonal elements .
[in] | Diagonal | - diagonal elements of matrix. |
void SymmetricSparse::bcksbstsk | ( | double * | U, |
double * | B, | ||
double | omega | ||
) | [protected] |
Auxiliary method used in the conjugate gradient method.
Makes the step of "back substitution" of the system: A * U = B.
[in] | B | - the residue vector. |
[in] | omega. | |
[out] | U | - the answer vector. |
long SymmetricSparse::CG | ( | double * | U, |
double * | B, | ||
long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Method to solve system of linear equations.
Standard conjugate gradient method.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - Maximum number of iterations. |
[in] | NormRes | - the residue norm of solution. |
[in] | Precision | - constant for the convergence test. |
[in] | Crit | - convergence criterion. |
[in] | Norm | - Norm type. 1 - Infinity norm 2 - Euclidean norm. |
[out] | U | - double pointer to answer vector. |
long SymmetricSparse::CGDiagonal | ( | double * | U, |
double * | B, | ||
long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Method to solve system of linear equations.
Conjugate gradient with the diagonal conditioning sparse matrix.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - Maximum number of iterations. |
[in] | NormRes | - the residue norm of solution. |
[in] | Precision | - constant for the convergence test. |
[in] | Crit | - convergence criterion. |
[in] | Norm | - Norm type. 1 - Infinity norm 2 - Euclidean norm. |
[out] | U | - double pointer to answer vector. |
long SymmetricSparse::CGPreConditionated | ( | double * | U, |
double * | B, | ||
long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
double | Omega = 1.81 , |
||
PreMatrix_E | PreMatrix = SGS , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Method to solve system of linear equations.
Conjugte gradient method with preconditioning SSOR (Symmetric Successive Overrelaxation Method) and GS (Gauss-Seidel Method) symmetric.
This method returns zero or the iterations number. if the calculus didn't converge and the maximum iterations number was overcome this method will returns zero. And if the calculus converged it will returns iterations number.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - Maximum number of iterations. |
[in] | NormRes | - the residue norm of solution. |
[in] | Precision | - constant for the convergence test. |
[in] | Omega | - parameter of relaxation. |
[in] | PreMatrix | - It is a enum type that indicates the preconditioning matrix type. |
[in] | Crit | - convergence criterion. |
[in] | Norm | - Norm type. 1 - Infinity norm 2 - Euclidean norm. |
[out] | U | - double pointer to answer vector. |
int SymmetricSparse::ConvCriteria | ( | double * | U, |
double * | Un, | ||
double * | b, | ||
double | Prec, | ||
double | Normb, | ||
ConvCriterion_E | Crit, | ||
NormDS_E | Norm, | ||
double & | NormRes | ||
) | [protected] |
Checks the convergence of iterative methods by criterias following:
Crit = 1: ||un+1 - un|| Crit = 2: ||rn+1|| = ||Aun+1 - b|| Crit = 3: ||rn+1|| = ||Aun+1 - b||/||b|| Norm = 1: ||.|| = euclidean norm Norm = 2: ||.|| = infinity norm
[in] | U | - pointer to vector operand. |
[in] | b. | |
[in] | Prec. | |
[in] | Normb. | |
[in] | Crit | - criterion of convergence. |
[in] | Norm. | |
[in] | NormRes. | |
[out] | Un | - Pointer to vector that contains the result. |
SymmetricSparse & SymmetricSparse::Equal | ( | SymmetricSparse & | Instance | ) |
This method assigns a matrix to another.
[in] | Instance | - symmetric sparse type. |
void SymmetricSparse::fwdsbstsk | ( | double * | U, |
double * | B, | ||
double | omega | ||
) | [protected] |
Auxiliary method used in the conjugate gradient method.
Makes the step of "forward substitution" of the system: A * U = B.
[in] | B | - the residue vector. |
[in] | omega. | |
[out] | U | - the answer vector. |
long SymmetricSparse::GaussSeidel | ( | double * | U, |
double * | B, | ||
unsigned long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Method to solve system of linear equations.
Gauss-Seidel iterative method.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - The maximum number of iterations. |
[in] | NormRes | - the residue norm of solution. |
[in] | Precision | - precision desired. |
[in] | Crit | - convergence criterion. |
[in] | Norm | - Norm type. 1 - Infinity norm 2 - Euclidean norm. |
[out] | U | - double pointer to answer vector. |
long SymmetricSparse::GaussSeidel | ( | double * | U, |
double * | B, | ||
unsigned long | NumberIter | ||
) |
Method to solve system of linear equations.
Gauss-Seidel iterative method. Runs a fixed number of iterations without verify the convergence.
[in] | B | - double pointer to independent terms. |
[in] | NumberIter | - The number of iterations. |
[out] | U | - double pointer to answer vector. |
void SymmetricSparse::GaussSolver | ( | double * | U, |
double * | B, | ||
double | Precision | ||
) |
Method to solve system of linear equations.
Gauss elimination method. U - solution and B - independent term)
[in] | B | - double pointer to independent terms. |
[in] | Precision. | |
[out] | U | - double pointer to answer vector. |
void SymmetricSparse::GaussSolver | ( | double | Precision = 1e-12 | ) |
Method to solve system of linear equations.
Matrix triangularization by the gauss method.
[in] | Precision |
void SymmetricSparse::GaussSolver | ( | double * | U, |
double * | B | ||
) |
Method to solve system of linear equations.
Solves system by the Gauss method - reduces vector and back substitution.
[in] | B | - double pointer to independent terms. |
[out] | U | - double pointer to answer vector. |
long SymmetricSparse::GetAverElementsLine | ( | ) |
Returns average elements number per row.
double & SymmetricSparse::GetElement | ( | unsigned long | Row, |
unsigned long | Column | ||
) |
Returns the element value and checks if it belongs to matrix.
[in] | Row | - Indicates the row number of the sparse matrix. |
[in] | Col | - Indicates the columns number of the sparse matrix. |
void SymmetricSparse::GetMaxMinDiagElems | ( | double & | MinDiagValue, |
double & | MaxDiagValue | ||
) |
the maximum and minimum absolute values of the diagonal.
[out] | MinDiagValue | - The minimum value of the diagonal. |
[out] | MaxDiagValue | - The maximum value of the diagonal. |
unsigned long SymmetricSparse::GetNumberElements | ( | ) |
Returns the elements number of the matrix.
unsigned long SymmetricSparse::GetNumElLine | ( | long | Lin | ) | [protected] |
Returns elements number of the row.
[in] | Lin | - the number of row. |
unsigned long SymmetricSparse::GetOrder | ( | ) |
Returns the matrix order.
void SymmetricSparse::GetTopology | ( | long & | MatrixOrder, |
long & | NumberElements, | ||
long & | MaxNumberElLine, | ||
long & | MinNumberElLine, | ||
long & | AverNumberElLine | ||
) |
the matrix topology.
[out] | MatrixOrder | - The order of matrix. |
[out] | NumberElements | - Number of elements not null of the matrix. |
[out] | MaxNumberElLine | - Maximum number of elements per row. |
[out] | MinNumberElLine | - Minimum number of elements per row. |
[out] | AverNumberElLine | - Average number of elements per row. |
void SymmetricSparse::Insert | ( | SymmetricMatrix & | SubMatrix, |
long * | LineCol | ||
) |
Inserts a sparse matrix from the rows and columns given in the 'LineCol' vector.
[in] | SubMatrix | - Sub-Matrix to be inserted in the sparse matrix. |
[in] | LineCol | - The row and column where will be inserted the sub-matrix. |
void SymmetricSparse::Insert | ( | SymmetricMatrix & | SubMatrix, |
long * | LineCol, | ||
unsigned long | InitLineCol | ||
) |
Inserts a sparse matrix from the rows and columns given in the 'LineCol' vector.
[in] | SubMatrix | - Sub-Matrix to be inserted in the sparse matrix. |
[in] | LineCol | - The row and column where will be inserted the sub-matrix. |
[in] | InitLineCol | - A variable used for verification of free degrees of freedom. For example, if the current column or line is lesser than this variable, it inserts the current value. |
long SymmetricSparse::Jacobi | ( | double * | U, |
double * | B, | ||
unsigned long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Method to solve system of linear equations.
Jacobi's iterative method.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - The maximum number of iterations. |
[in] | NormRes | - the residue norm of solution. |
[in] | Precision | - precision desired. |
[in] | Crit | - convergence criterion. |
[in] | Norm | - Norm type. 1 - Infinity norm 2 - Euclidean norm. |
[out] | U | - double pointer to answer vector. |
long SymmetricSparse::Jacobi | ( | double * | U, |
double * | B, | ||
unsigned long | MaxNumberIter | ||
) |
Method to solve system of linear equations.
Jacobi's iterative method. Runs a fixed number of iterations without verify the convergence.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - The maximum number of iterations. |
[out] | U | - double pointer to answer vector. |
void SymmetricSparse::Multiplicate | ( | double * | X, |
double * | Y | ||
) |
Multiplies matrix by a vector: x = A.y.
[in] | Y | - Entry vector to be multiplied by the sparse matrix. |
[out] | X | - Result vector of multiplication the sparse matrix by the vector "Y". |
void SymmetricSparse::Multiplicate | ( | double | scalar | ) |
Multiplies matrix by a scalas: A = A*scalar.
[in] | scalar | - Scalar; |
double SymmetricSparse::norinfv | ( | double * | u, |
long | dim | ||
) | [protected] |
Calculates the infinity norm of the array.
[in] | *u | - array of double. |
[in] | dim | - dimension of the array u. |
double SymmetricSparse::normaev | ( | double * | u, |
long | dim | ||
) | [protected] |
Calculate the euclidean norm of a vector.
[in] | *u | - the vector which will be calculated the euclidean norm. |
[in] | dim | - dimension of vector u. |
SymmetricSparse::operator long *const | ( | ) |
Convert 'SymmetricSparse' to 'long*'.
SymmetricSparse::operator SSM_T *const | ( | ) |
Convert 'SymmetricSparse' to 'double*'.
double & SymmetricSparse::operator() | ( | long | Row, |
long | Col | ||
) |
Overlap Opertor '()'.
Returns the value of the position '(Row, Col)'
[in] | Row | - Indicates the row number of the sparse matrix. |
[in] | Col | - Indicates the columns number of the sparse matrix. |
SymmetricSparse & SymmetricSparse::operator= | ( | SymmetricSparse & | Instance | ) |
Assignment operator '='.
Ex.: A = B;
[in] | Instance | - symmetric sparse type. |
void SymmetricSparse::prauxsk | ( | double * | U, |
double * | B | ||
) | [protected] |
Auxiliary method used in the conjugate gradient method.
Solve the system D.x = b (where D is a diagonal matrix).
[in] | B. | |
[out] | U. |
void SymmetricSparse::Print | ( | FILE * | File, |
int | Mant, | ||
int | Dec | ||
) |
Prints the matrix in a ASCII file in the suitable format for the SymmetricSparse(FILE*) constructor.
This format is following: the matrix order, diagonal vector and the coeficients (row, columns, value). Example: 3 0 2 4 5 0 0 1.2 0 1 2.0 1 1 3.2 1 2 5.4 2 2 10.84
[in] | File | - the file where will be printed the matrix data. |
[in] | Title | - this a header to indicate a operation type. |
[in] | Format | - the data format to be printed. |
void SymmetricSparse::Print | ( | FILE * | File = stdout , |
const char * | Message = "" , |
||
int | NumMaxCols = 5 , |
||
int | Mant = 14 , |
||
int | Dec = 7 |
||
) |
Prints the matrix in ASCII format.
Prints the band of matrix by row.
[in] | File | - the file where will be printed the sparse matrix data. (the default is stdout) |
[in] | Message | - Indicates the operation type that was run. |
[in] | NumMaxCols | - the maximum value of columns that can be printed by row. |
[in] | Mant | - Indicates the space size that should have between columns. |
[in] | Dec | - Indicates the size of the decimal part to be printed. |
void SymmetricSparse::PrintTopology | ( | FILE * | File | ) |
Prints the matrix topology.
[in] | File | - the file where will be printed the topology of sparse matrix. (the default is stdout) |
void SymmetricSparse::prodauxsk | ( | double * | X, |
double * | Y, | ||
double | cte | ||
) | [protected] |
Auxiliary method used in the conjugate gradient method.
This method makes the product between the element of main diagonal of the matrix of system and the element correspondent of the output 'y' vector provided by fwdsbstsk function.
[in] | Y. | |
[in] | cte. | |
[out] | X. |
void SymmetricSparse::prodfx | ( | double * | Z, |
double * | X, | ||
double | Omega | ||
) | [protected] |
Auxiliary method used in the conjugate gradient method.
Makes the product "z = F.x", where F is upper triangular matrix.
[in] | X. | |
[in] | omega. | |
[out] | Z. |
void SymmetricSparse::Reset | ( | double | Value = 0.0 | ) |
Reinitializes the elements with the value contained in the "Value" parameter.
[in] | Value | - The value to reinitialize the sparse matrix. |
void SymmetricSparse::Restore | ( | FILE * | File | ) |
Reads the matrix from a binary file.
[in] | File | - the binary file where the sparse matrix will be read. |
void SymmetricSparse::Restore | ( | char * | TabName, |
int | Version, | ||
char * | Filename | ||
) |
Reads the matrix from the 'acdp' database.
[in] | TabName | - the table name of the database to read sparse matrix data. |
[in] | Version | - the version of the read data. |
[in] | Filename | - the database name. |
void SymmetricSparse::Save | ( | FILE * | File | ) |
Saves the matrix in a binary file.
[in] | File | - the file to save the sparse matrix data. |
void SymmetricSparse::Save | ( | char * | TabName, |
int | Version, | ||
char * | Filename | ||
) |
Saves the matrix in the 'acdp' database.
[in] | TabName | - the table name of the database to saved sparse matrix data. |
[in] | Version | - the version of the update data. |
[in] | Filename | - Stores the database name. |
double SymmetricSparse::scalv | ( | double * | x, |
double * | y, | ||
unsigned long | dim | ||
) | [protected] |
Calculates the product scalar between two vectors.
[in] | *x | - first vector. |
[in] | *y | - second vector. |
[in] | dim | - dimension of vector x and y. |
void SymmetricSparse::SetOrder | ( | unsigned long | MatrixOrder, |
long * | Diagonal = NULL , |
||
double | Value = 0.0 |
||
) |
Initializes the matrix order through the elements number per row.
[in] | MatrixOrder | - The order sparse matrix. |
[in] | Diagonal | - Diagonal elements of the sparse matrix. |
[in] | Value | - The initial value to the sparse matrix. |
void SymmetricSparse::SetOrder | ( | unsigned long | MatrixOrder, |
long | NumberElements, | ||
double | Value = 0.0 |
||
) |
Initializes the matrix order and the elements number of the matrix.
[in] | MatrixOrder | - The order sparse matrix. |
[in] | NumberElements. | |
[in] | Value | - The initial value to the sparse matrix. |
long SymmetricSparse::SizeOf | ( | ) |
Returns the bytes number occupied by the matrix.
long SymmetricSparse::SOR | ( | double * | U, |
double * | B, | ||
long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
double | Omega = 1.81 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Method to solve system of linear equations.
SOR iterative method.
[in] | B | - double pointer to independent terms. |
[in] | MaxNumberIter | - The maximum number of iterations. |
[in] | NormRes | - the residue norm of solution. |
[in] | Precision | - constant for the convergence test. |
[in] | Omega | - parameter of relaxation. |
[in] | Crit | - convergence criterion. |
[in] | Norm | - Norm type. 1 - Infinity norm 2 - Euclidean norm. |
[out] | U | - double pointer to answer vector. |
double* SymmetricSparse::d [protected] |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method.
Vector used in the iterative methods.
double* SymmetricSparse::f [protected] |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method.
Vector used in the iterative methods.
double* SymmetricSparse::g [protected] |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method.
Vector used in the iterative methods.
double* SymmetricSparse::h [protected] |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method.
Vector used in the iterative methods.
long* SymmetricSparse::Pos [protected] |
Auxiliary vector used in the methods for solve system of linear equations and for the "Insert" method.
Stores the position of the elements along a row.