hp2FEM
0.1
|
Public Member Functions | |
SymmetricMatrix () | |
Empty constructor. | |
SymmetricMatrix (long MatrixOrder, double InitValue=0.0) | |
Constructor with parameters. | |
SymmetricMatrix (FILE *File) | |
Constructor with parameters. | |
SymmetricMatrix (SymmetricMatrix &Instance) | |
Copy constructor. | |
~SymmetricMatrix () | |
SymmetricMatrix & | operator= (SymmetricMatrix &Instance) |
Assignment operator '='. | |
SymmetricMatrix & | Equal (SymmetricMatrix &Instance) |
Assignment function. | |
operator double *const () | |
Converts from SymmetricMatrix to doulbe*. | |
double & | operator() (long Row, long Col) |
Accesses the elements of the matrix. | |
double & | GetElement (unsigned long Row, unsigned long Column) |
Returns the element of the matrix through parameters row and column. | |
void | SetOrder (unsigned long MatrixOrder=0, double InitValue=0.0) |
Initializes the matrix order. | |
unsigned long | GetOrder () |
Returns the matrix order. | |
unsigned long | GetNumberElements () |
Returns the elements number of symmetric matrix. | |
long | SizeOf () |
Returns the bytes number occupied by the symmetric matrix. | |
void | Reset (double Value=0.0) |
Reboots the elements of the matrix with a value determinate. | |
void | Reset (unsigned long NumEls, double Value=0.0) |
Reboots the elements of the matrix with a value determinate. | |
void | Identity () |
Transforms the matrix to a identity matrix. | |
void | Insert (SymmetricMatrix &SubMatrix, long InitLine=0, long InitColumn=0) |
Inserts a symmetric sub-matrix from the parameters: rows and columns. | |
double | Maximum () |
Returns the largest element of the symmetric matrix. | |
double | Minimum () |
Returns the smallest element of the symmetric matrix. | |
double | EuclideanNorm () |
Returns euclidean norm of the symmetric matrix. | |
void | Product (double *A, unsigned long N, double b=1.0) |
double | OneNorm () |
Returns the norm-1 of the symmetric matrix. | |
double | InfinityNorm () |
Returns infinity norm of the symmetric matrix: norm-1 = inifinity norm. | |
SymmetricMatrix & | Chs () |
Changes the signal of the symmetric matrix elements. | |
SymmetricMatrix & | operator- () |
Changes the signal of the symmetric matrix elements. | |
SymmetricMatrix & | Add (SymmetricMatrix &A, SymmetricMatrix &B) |
Symmetric matrix addition. | |
SymmetricMatrix & | operator+= (SymmetricMatrix &B) |
Symmetric matrix addition. | |
SymmetricMatrix & | Add (SymmetricMatrix &B) |
Symmetric matrix addition. | |
SymmetricMatrix & | Add (SymmetricMatrix &B, unsigned long NumEls) |
Symmetric matrix addition. | |
void | AddMultiplicate (SymmetricMatrix &B, double scalar, unsigned long NumEls) |
Symmetric matrix addition and multiplication. It also resets B matrix. | |
SymmetricMatrix & | Subtract (SymmetricMatrix &A, SymmetricMatrix &B) |
Symmetric matrix subtraction. | |
SymmetricMatrix & | operator-= (SymmetricMatrix &B) |
Symmetric matrix subtraction. | |
SymmetricMatrix & | Subtract (SymmetricMatrix &B) |
Symmetric matrix subtraction. | |
SymmetricMatrix & | Add (double Scalar) |
Addition of a scalar in the symmetric matrix. | |
SymmetricMatrix & | operator+= (double Scalar) |
Addition of a scalar in the symmetric matrix. | |
SymmetricMatrix & | Subtract (double Scalar) |
Subtraction of a scalar of the symmetric matrix. | |
SymmetricMatrix & | operator-= (double Scalar) |
Subtraction of a scalar of the symmetric matrix. | |
SymmetricMatrix & | operator*= (double Scalar) |
Multiplication of a scalar by the symmetric matrix. | |
SymmetricMatrix & | Multiplicate (double Scalar) |
Multiplication of a scalar by the symmetric matrix. | |
void | Multiplicate (double *X, double *Y) |
Multiplies the symmetric matrix by a vector: x = A.y. | |
void | Multiplicate (double *X, unsigned long Size, double *Y) |
Multiplies the symmetric matrix by a vector: x = A.y. | |
void | Multiplicate (double *A, unsigned long nlA, unsigned long ncA, double *B, unsigned long nlB, unsigned long ncB) |
Multiplies two matrices (any double*), yielding a symmetric matrix. A*B = SymettricMatrix. | |
void | TripleProduct (Matrix &A, SymmetricMatrix &B) |
Triple product: "this = At * B * A". | |
void | TripleProduct (double *A, unsigned short NlinesA, unsigned short NcolsA, SymmetricMatrix &B) |
Triple product: "this = At * B * A". | |
double | ScalarProduct (SymmetricMatrix &B) |
Scalar product between symmetric matrices. | |
double | operator^ (SymmetricMatrix &B) |
Scalar product between symmetric matrices. | |
void | Save (FILE *File) |
Saves the matrix in a binary file. | |
void | Save (char *Tabname, int Version, char *Filename) |
Saves the symmetric matrix in the "acdp" database. | |
void | Restore (FILE *File) |
Reads the symmetric matrix from a binary file. | |
void | Restore (char *Tabname, int Version, char *Filename) |
Reads the symmetric matrix from the "acdp" database. | |
void | Print (FILE *File, char *Title, char *Format) |
Prints the matrix in ASCII format. | |
void | Print (FILE *File=stdout, const char *Message="", int NumMaxCols=5, int Mant=14, int Dec=7) |
Prints the matrix in ASCII format. | |
void | Print (FILE *File, int Mant, int Dec) |
void | Free () |
Fees memory area allocated for the matrix. | |
void | GaussSolver (double *U, double *B, double Precision) |
Method to solve system of linear equations. | |
void | GaussSolver () |
Method to solve system of linear equations. | |
void | GaussSolver (double *U, double *B) |
Solves linear system by Gauss method - back substitution. | |
long | Jacobi (double *U, double *B, long NumberIterations, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Jacobi's Iterative Method. | |
void | EigJacobi (SymmetricMatrix &B, double tol, SymmetricMatrix &eigv, Matrix &eigvec) |
Calculates the eigenvalues and eigenvectors of the generalized eigensystem: [A]{x} = {lambda}[B]{x} using the Jacobi method. Matrices A and B must be symmetrical and positive-definite. Matrix A is the one you are calling here in DS. | |
long | GaussSeidel (double *U, double *B, long NumberIterations, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Gauss-Seidel iterative method. | |
long | SOR (double *U, double *B, long NumberIterations, double &NormRes, double Precision=1e-4, double Omega=1.81, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
SOR (succesive over relaxation) iterative method. | |
long | CG (double *U, double *B, long MaxNumberIter, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Standard conjugate gradient. | |
long | CGDiagonal (double *U, double *B, long MaxNumberIter, double &NormRes, double Precision=1e-4, ConvCriterion_E Crit=WEIGHT_RESIDUE, NormDS_E Norm=EUCLID) |
Conjugate gradient method with diagonal conditioned matrix. | |
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) |
Preconditioned conjugate gradient method. | |
Protected Member Functions | |
void | FreeAuxVectors () |
Frees the memory area to the auxiliary vectors. | |
void | Alloc (double InitValue=0.0) |
Allocates memory space to the matrix. | |
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. | |
void | praux (double *vetb, double *vetx) |
Auxiliary function for gradient method with diagonal matrix. | |
void | fwdsubst (double *vetx, double *vetb, double omega) |
Auxiliary function for gradient method with preconditioning. | |
void | prodaux (double *U, double *Y, double cte) |
Runs product between the main diagonal of matrix and the element correspondent of the output 'vaux' vector provided by 'fwdsubst' function. | |
void | bcksubst (double *vetx, double *vetb, double omega) |
Thalot routine makes the step of back substitution of the system: 'ma' * 'vetaux' = 'vaux'. | |
void | prodfx (double *z, double *x, double Omega) |
Solve the system: z = F.x, where F is the upper triangular matrix. | |
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. | |
int | mgausimt (double *mas, long neq, long *step) |
Gaussian Elimination Method. | |
void | pmatbsa (double *mcs, double *ma, long nlina, long ncola, double *mbs) |
Calculates the matricial product. The product is performed according to mathematic formula below: Ci,j = At i,k * Bk,r * Ar,j. | |
void | promabs (double *mc, double *ma, double *mbs, long nlina, long ncola) |
Multiplies a matrix of the double type stored by rows by a symmetric matrix also of the double type stored in the shape supra-diagonal by rows. | |
void | solgasim (double *vetx, double *mas, double *vetb, long int neq) |
Resolves a system of linear equations by Gaussian Elimination Method. | |
Protected Attributes | |
unsigned long | PolyOrder |
Stores the order of matrix. | |
double * | d |
Auxiliary vector used in the methods to solve systems of equations. | |
double * | f |
Auxiliary vector used in the methods to solve systems of equations. | |
double * | g |
Auxiliary vector used in the methods to solve systems of equations. | |
double * | h |
Auxiliary vector used in the methods to solve systems of equations. | |
double * | SMatrix |
Elements of matrix stored in the vector. | |
DoublePtr_T * | PSLines |
Vector of pointers to the rows. | |
char | ExtraMemory [SizeExtraMemSM] |
Extra memory used in the memory alignment during allocation of class object. | |
Friends | |
SymmetricMatrix | operator+ (SymmetricMatrix &A, SymmetricMatrix &B) |
Symmetric matrix addition. | |
SymmetricMatrix | operator- (SymmetricMatrix &A, SymmetricMatrix &B) |
Symmetric matrix subtraction. | |
void | Multiplicate (Matrix &A, SymmetricMatrix &B, Matrix &C) |
Runs the operation of multiplication: A = B * C (A and C are full. B is symmetric). |
SymmetricMatrix::SymmetricMatrix | ( | long | MatrixOrder, |
double | InitValue = 0.0 |
||
) |
Constructor with parameters.
[in] | MatrixOrder | - The order matrix. |
[in] | InitValue | - The initial value to the matrix. |
SymmetricMatrix::SymmetricMatrix | ( | FILE * | File | ) |
Constructor with parameters.
Creates the matrix through reading a ASCII data file.
[in] | File | - A binary file. |
SymmetricMatrix::SymmetricMatrix | ( | SymmetricMatrix & | Instance | ) |
Copy constructor.
[in] | Instance | - symmetric matrix type. |
SymmetricMatrix & SymmetricMatrix::Add | ( | SymmetricMatrix & | A, |
SymmetricMatrix & | B | ||
) |
Symmetric matrix addition.
Ex.: C.Add(A, B).
[in] | A | - the symmetric matrix A to be summed. |
[in] | B | - the symmetric matrix B to be summed. |
Symmetric matrix addition.
Ex.: A.Add(B).
[in] | B | - a symmetric matrix to be sum. |
SymmetricMatrix & SymmetricMatrix::Add | ( | SymmetricMatrix & | B, |
unsigned long | NumEls | ||
) |
Symmetric matrix addition.
Ex.: A.Add(B).
[in] | B | - a symmetric matrix to be sum. |
[in] | NumEls | - Number of elements of both matrices. |
SymmetricMatrix & SymmetricMatrix::Add | ( | double | Scalar | ) |
Addition of a scalar in the symmetric matrix.
Ex.: A.Add(10).
[in] | Scalar | - Scalar value to be added in the symmetric matrix. |
void SymmetricMatrix::AddMultiplicate | ( | SymmetricMatrix & | B, |
double | scalar, | ||
unsigned long | NumEls | ||
) |
Symmetric matrix addition and multiplication. It also resets B matrix.
Ex.: A.Add(B).
[in] | B | - a symmetric matrix to be operated. |
[in] | scalar | - A scalar value to be multiplied. |
[in] | NumEls | - Number of elements of both matrices. |
void SymmetricMatrix::Alloc | ( | double | InitValue = 0.0 | ) | [protected] |
Allocates memory space to the matrix.
[in] | InitValue | - Initial Value to set the elements of matrix. |
void SymmetricMatrix::bcksubst | ( | double * | vetx, |
double * | vetb, | ||
double | omega | ||
) | [protected] |
Thalot routine makes the step of back substitution of the system: 'ma' * 'vetaux' = 'vaux'.
[in] | vetb. | |
[in] | omega. | |
[out] | vetx. |
long SymmetricMatrix::CG | ( | double * | U, |
double * | B, | ||
long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Standard conjugate gradient.
[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 SymmetricMatrix::CGDiagonal | ( | double * | U, |
double * | B, | ||
long | MaxNumberIter, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Conjugate gradient method with diagonal conditioned 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 SymmetricMatrix::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 |
||
) |
Preconditioned 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] | 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. |
Changes the signal of the symmetric matrix elements.
Ex.: A.Chs();
int SymmetricMatrix::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.
[in] | U | - pointer to vector operand. |
[in] | b. | |
[in] | Prec. | |
[in] | Normb. | |
[in] | Crit. | |
[in] | Norm. | |
[in] | NormRes. | |
[out] | Un | - Pointer to vector that contains the result. |
void SymmetricMatrix::EigJacobi | ( | SymmetricMatrix & | B, |
double | tol, | ||
SymmetricMatrix & | eigv, | ||
Matrix & | eigvec | ||
) |
Calculates the eigenvalues and eigenvectors of the generalized eigensystem: [A]{x} = {lambda}[B]{x} using the Jacobi method. Matrices A and B must be symmetrical and positive-definite. Matrix A is the one you are calling here in DS.
[in] | B | - matrix of the right-hand side of the eigensystem |
[in] | tol | - numerical tolerance |
[out] | eigv | - Diagonal matrix with eigenvalues |
[out] | eigvec | - matrix with eigenvectors |
SymmetricMatrix & SymmetricMatrix::Equal | ( | SymmetricMatrix & | Instance | ) |
Assignment function.
Ex.: A.Equal(B);
[in] | Instance | - the symmetric matrix type. |
double SymmetricMatrix::EuclideanNorm | ( | ) |
Returns euclidean norm of the symmetric matrix.
void SymmetricMatrix::fwdsubst | ( | double * | vetx, |
double * | vetb, | ||
double | omega | ||
) | [protected] |
Auxiliary function for gradient method with preconditioning.
[in] | vetb | - the residue vector. |
[in] | omega. | |
[out] | vetx | - the answer vector. |
long SymmetricMatrix::GaussSeidel | ( | double * | U, |
double * | B, | ||
long | NumberIterations, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Gauss-Seidel iterative method.
[in] | B | - double pointer to independent terms. |
[in] | NumberIterations | - 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. |
void SymmetricMatrix::GaussSolver | ( | double * | U, |
double * | B, | ||
double | Precision | ||
) |
Method to solve system of linear equations.
Gauss Elimination Method.
[in] | B | - double pointer to independent terms. |
[in] | Precision. | |
[out] | U | - double pointer to answer vector. |
void SymmetricMatrix::GaussSolver | ( | ) |
Method to solve system of linear equations.
Triangularization of the matrix by gauss method.
void SymmetricMatrix::GaussSolver | ( | double * | U, |
double * | B | ||
) |
Solves linear system by Gauss method - back substitution.
[in] | B | - double pointer to independent terms. |
[out] | U | - double pointer to answer vector. |
double & SymmetricMatrix::GetElement | ( | unsigned long | Row, |
unsigned long | Column | ||
) |
Returns the element of the matrix through parameters row and column.
Checks if (Row, Col) belongs the matrix.
[in] | Row | - the rows number of symmetric matrix. |
[in] | Col | - the columns number of symmetric matrix. |
unsigned long SymmetricMatrix::GetNumberElements | ( | ) |
Returns the elements number of symmetric matrix.
unsigned long SymmetricMatrix::GetOrder | ( | ) |
Returns the matrix order.
double SymmetricMatrix::InfinityNorm | ( | ) |
Returns infinity norm of the symmetric matrix: norm-1 = inifinity norm.
void SymmetricMatrix::Insert | ( | SymmetricMatrix & | SubMatrix, |
long | InitLine = 0 , |
||
long | InitColumn = 0 |
||
) |
Inserts a symmetric sub-matrix from the parameters: rows and columns.
[in] | SubMatrix | - Sub-Matrix to be inserted in the symmetric matrix. |
[in] | InitLine | - The row where will be inserted the sub-matrix. |
[in] | InitColumn | - The column where will be inserted the sub-matrix. |
long SymmetricMatrix::Jacobi | ( | double * | U, |
double * | B, | ||
long | NumberIterations, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
Jacobi's Iterative Method.
[in] | U | - double pointer to answer vector. |
[in] | B | - double pointer to independent terms. |
[in] | NumberIterations | - 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. |
double SymmetricMatrix::Maximum | ( | ) |
Returns the largest element of the symmetric matrix.
int SymmetricMatrix::mgausimt | ( | double * | mas, |
long | neq, | ||
long * | step | ||
) | [protected] |
Gaussian Elimination Method.
Triangularize the system matrix according to gaussian elimination. The system matrix and symmetric are stored on the shape of the supra diagonal by rows. This routine returns a code informing whether obtained successful in the triangularization or not, in which case there was singularity of the system matrix preventing the continuation of the gauss method.
[in] | *mas | - system matrix. |
[in] | neq | - number of equations |
[in] | step | - 'k' step of the proccess of the 'forward elimination' |
double SymmetricMatrix::Minimum | ( | ) |
Returns the smallest element of the symmetric matrix.
SymmetricMatrix & SymmetricMatrix::Multiplicate | ( | double | Scalar | ) |
void SymmetricMatrix::Multiplicate | ( | double * | X, |
double * | Y | ||
) |
Multiplies the symmetric matrix by a vector: x = A.y.
[in] | Y | - The vector to be multiplies by the symmetric matrix. |
[out] | X | - The resultant vector of product of a symmetric matrix by a vector. |
void SymmetricMatrix::Multiplicate | ( | double * | X, |
unsigned long | Size, | ||
double * | Y | ||
) |
Multiplies the symmetric matrix by a vector: x = A.y.
[in] | Y | - The vector to be multiplies by the symmetric matrix. |
[in] | Size | - The number of columns of the matrix and number of rows of the vector. |
[out] | X | - The resultant vector of product of a symmetric matrix by a vector. |
void SymmetricMatrix::Multiplicate | ( | double * | A, |
unsigned long | nlA, | ||
unsigned long | ncA, | ||
double * | B, | ||
unsigned long | nlB, | ||
unsigned long | ncB | ||
) |
Multiplies two matrices (any double*), yielding a symmetric matrix. A*B = SymettricMatrix.
[in] | A | - Given matrix. |
[in] | nlA | - Number of lines of A. |
[in] | ncA | - Number of columns of A. |
[in] | B | - Another matrix. |
[in] | nlB | - Number of lines of B. |
[in] | ncB | - Number of columns of B. |
double SymmetricMatrix::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 SymmetricMatrix::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. |
double SymmetricMatrix::OneNorm | ( | ) |
Returns the norm-1 of the symmetric matrix.
SymmetricMatrix::operator double *const | ( | ) |
Converts from SymmetricMatrix to doulbe*.
double & SymmetricMatrix::operator() | ( | long | Row, |
long | Col | ||
) |
Accesses the elements of the matrix.
[in] | Row | - the rows number of symmetric matrix. |
[in] | Col | - the columns number of symmetric matrix. |
SymmetricMatrix & SymmetricMatrix::operator*= | ( | double | Scalar | ) |
SymmetricMatrix & SymmetricMatrix::operator+= | ( | SymmetricMatrix & | B | ) |
Symmetric matrix addition.
Ex.: A += B.
[in] | B | - a symmetric matrix to be sum. |
SymmetricMatrix & SymmetricMatrix::operator+= | ( | double | Scalar | ) |
SymmetricMatrix & SymmetricMatrix::operator- | ( | ) |
Changes the signal of the symmetric matrix elements.
Ex.: -A;
SymmetricMatrix & SymmetricMatrix::operator-= | ( | SymmetricMatrix & | B | ) |
Symmetric matrix subtraction.
Ex.: A -= B.
[in] | B | - The symmetric matrix to be subtracted. |
SymmetricMatrix & SymmetricMatrix::operator-= | ( | double | Scalar | ) |
Subtraction of a scalar of the symmetric matrix.
Ex.: A -= 10.
[in] | Scalar | - Scalar value to be subtracted in the symmetric matrix. |
SymmetricMatrix & SymmetricMatrix::operator= | ( | SymmetricMatrix & | Instance | ) |
Assignment operator '='.
Ex.: A = B.
[in] | - | Instance - the symmetric matrix type. |
double SymmetricMatrix::operator^ | ( | SymmetricMatrix & | B | ) |
Scalar product between symmetric matrices.
Ex.: r = A ^ B.
[in] | B | - The symmetric matrix to be multiplied. |
void SymmetricMatrix::pmatbsa | ( | double * | mcs, |
double * | ma, | ||
long | nlina, | ||
long | ncola, | ||
double * | mbs | ||
) | [protected] |
Calculates the matricial product. The product is performed according to mathematic formula below: Ci,j = At i,k * Bk,r * Ar,j.
Considers that the second matrix is symmetric and pre-multiplies by the transposed of the first matrix resulting in the symmetric matrix stored in the shape supra-diagonal by rows, that is, performes the product CS = AT * BS * A.
[in] | *mcs | - pointer to the resulted matrix. |
[in] | *ma | - pointer to the 'ma' matrix. |
[in] | nlina | - number of rows of the 'ma' matrix. |
[in] | ncola | - number of colums of the 'ma' matrix. |
[out] | *mbs | - pointer to the symmetric matrix. |
void SymmetricMatrix::praux | ( | double * | vetb, |
double * | vetx | ||
) | [protected] |
Auxiliary function for gradient method with diagonal matrix.
[in] | vetb. | |
[out] | vetx. |
void SymmetricMatrix::Print | ( | FILE * | File, |
char * | Title, | ||
char * | Format | ||
) |
Prints the matrix in ASCII format.
Ex.: A.Print(File, "matrix1", "%7.2lf").
[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 SymmetricMatrix::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. Ex.: A.Print(File, "matrix1", 18, 7).
[in] | File | - the file where will be printed the symmetric matrix data. (the default is stdout) |
[in] | Message | - Indicates the operation type that was run. |
[in] | NumMaxCols | - the maximum value of columns that can 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 SymmetricMatrix::Print | ( | FILE * | File, |
int | Mant, | ||
int | Dec | ||
) |
Prints the matrix in ASCII file to suitable format for SymmetricSparse(FILE *) constructor.
The format is following: matrix order and coeficients. 3 1.2 2.0 3.2 5.4 10.84 23.87
[in] | File | - the file where will be printed the symmetric matrix data. (the default is stdout) |
[in] | Mant | - Indicates the space size that should have between columns. |
[in] | Dec | - Indicates the size of the decimal part to be printed. |
void SymmetricMatrix::prodaux | ( | double * | U, |
double * | Y, | ||
double | cte | ||
) | [protected] |
Runs product between the main diagonal of matrix and the element correspondent of the output 'vaux' vector provided by 'fwdsubst' function.
[in] | Y. | |
[in] | cte. | |
[out] | U. |
void SymmetricMatrix::prodfx | ( | double * | z, |
double * | x, | ||
double | Omega | ||
) | [protected] |
Solve the system: z = F.x, where F is the upper triangular matrix.
[in] | x | - the upper triangular matrix. |
[in] | omega. | |
[out] | z | - the result matrix. |
void SymmetricMatrix::Product | ( | double * | A, |
unsigned long | N, | ||
double | b = 1.0 |
||
) |
void SymmetricMatrix::promabs | ( | double * | mc, |
double * | ma, | ||
double * | mbs, | ||
long | nlina, | ||
long | ncola | ||
) | [protected] |
Multiplies a matrix of the double type stored by rows by a symmetric matrix also of the double type stored in the shape supra-diagonal by rows.
param[out] *mc - pointer to the resulted matrix param[in] *ma - pointer to the 'ma' matrix param[in] *mbs - pointer to the symmetric matrix param[in] nlina - number of rows of the 'ma' matrix param[in] ncola - number of columns of the 'ma' matrix
void SymmetricMatrix::Reset | ( | double | Value = 0.0 | ) |
Reboots the elements of the matrix with a value determinate.
[in] | Value | - Used to initialize the elements of matrix. |
void SymmetricMatrix::Reset | ( | unsigned long | NumEls, |
double | Value = 0.0 |
||
) |
Reboots the elements of the matrix with a value determinate.
[in] | NumEls | - Number of elements, to avoid calculating inside the function. |
[in] | Value | - Used to initialize the elements of matrix. |
void SymmetricMatrix::Restore | ( | FILE * | File | ) |
Reads the symmetric matrix from a binary file.
Ex.: A.Restore(File).
[in] | File | - the binary file where the symmetric matrix will read. |
void SymmetricMatrix::Restore | ( | char * | Tabname, |
int | Version, | ||
char * | Filename | ||
) |
Reads the symmetric matrix from the "acdp" database.
Ex.: A.Restore("matrix1", 1, "matbda").
[in] | TabName | - the table name of the database to read matrix data. |
[in] | Version | - the version of the read data. |
[in] | Filename | - the database name. |
void SymmetricMatrix::Save | ( | FILE * | File | ) |
Saves the matrix in a binary file.
Ex.: A.Save(File).
[in] | File | - the file to save the matrix data. |
void SymmetricMatrix::Save | ( | char * | Tabname, |
int | Version, | ||
char * | Filename | ||
) |
Saves the symmetric matrix in the "acdp" database.
Ex.: A.Save("matrix1", 1, "matbda").
[in] | TabName | - the table name of the database to saved symmetric matrix data. |
[in] | Version | - the version of the update data. |
[in] | Filename | - Stores the database name. |
double SymmetricMatrix::ScalarProduct | ( | SymmetricMatrix & | B | ) |
Scalar product between symmetric matrices.
Ex.: r = A.ScalarProduct(B).
[in] | B | - The symmetric matrix to be multiplied. |
double SymmetricMatrix::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 SymmetricMatrix::SetOrder | ( | unsigned long | MatrixOrder = 0 , |
double | InitValue = 0.0 |
||
) |
Initializes the matrix order.
[in] | MatrixOrder | - The order matrix. |
[in] | InitValue | - The initial value to the matrix. |
long SymmetricMatrix::SizeOf | ( | ) |
Returns the bytes number occupied by the symmetric matrix.
void SymmetricMatrix::solgasim | ( | double * | vetx, |
double * | mas, | ||
double * | vetb, | ||
long int | neq | ||
) | [protected] |
Resolves a system of linear equations by Gaussian Elimination Method.
This method performing the modification of the independent terms according to the obted result in the mgausimt function and of the step of the 'back substitution'. This function allows the user solve a system with multiple vector of the load. The system matrix is of the symmetric type stored in the shape supra-diagonal by rows and is provided triangularized by mgausimt function.
[out] | *vetx | - pointer the answer vector. |
[in] | *mas | - pointer to the system matrix. |
[in] | *vetb | - pointer to the vector of independent terms. |
[in] | neq | - number of equations. |
long SymmetricMatrix::SOR | ( | double * | U, |
double * | B, | ||
long | NumberIterations, | ||
double & | NormRes, | ||
double | Precision = 1e-4 , |
||
double | Omega = 1.81 , |
||
ConvCriterion_E | Crit = WEIGHT_RESIDUE , |
||
NormDS_E | Norm = EUCLID |
||
) |
SOR (succesive over relaxation) iterative method.
[in] | B | - double pointer to independent terms. |
[in] | NumberIterations | - Iterations number. |
[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. |
SymmetricMatrix & SymmetricMatrix::Subtract | ( | SymmetricMatrix & | A, |
SymmetricMatrix & | B | ||
) |
Symmetric matrix subtraction.
Ex.: C.Subtract(A, B).
[in] | A. | |
[in] | B. |
Symmetric matrix subtraction.
Ex.: A.Subtract(B).
[in] | B | - The symmetric matrix to be subtracted. |
SymmetricMatrix & SymmetricMatrix::Subtract | ( | double | Scalar | ) |
Subtraction of a scalar of the symmetric matrix.
Ex.: A.Subtract(10).
[in] | Scalar | - Scalar value to be subtracted in the symmetric matrix. |
void SymmetricMatrix::TripleProduct | ( | Matrix & | A, |
SymmetricMatrix & | B | ||
) |
Triple product: "this = At * B * A".
[in] | A | - the matrix to be multiplied. |
[in] | B | - the symmetric matrix to be multiplied. |
void SymmetricMatrix::TripleProduct | ( | double * | A, |
unsigned short | NlinesA, | ||
unsigned short | NcolsA, | ||
SymmetricMatrix & | B | ||
) |
Triple product: "this = At * B * A".
[in] | A | - the matrix to be multiplied. |
[in] | B | - the symmetric matrix to be multiplied. |
void Multiplicate | ( | Matrix & | A, |
SymmetricMatrix & | B, | ||
Matrix & | C | ||
) | [friend] |
Runs the operation of multiplication: A = B * C (A and C are full. B is symmetric).
[in] | B | - the symmetric matrix to be multiplicated. |
[in] | C | - the matrix to be multiplicated. |
[out] | A | - the matrix that stores the result of multiplication. |
SymmetricMatrix operator+ | ( | SymmetricMatrix & | A, |
SymmetricMatrix & | B | ||
) | [friend] |
Symmetric matrix addition.
Ex.: C= A + B.
[in] | A | - the symmetric matrix A to be summed. |
[in] | B | - the symmetric matrix B to be summed. |
SymmetricMatrix operator- | ( | SymmetricMatrix & | A, |
SymmetricMatrix & | B | ||
) | [friend] |
Symmetric matrix subtraction.
Ex.: C = A - B.
[in] | A. | |
[in] | B. |