hp2FEM  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
SymmetricMatrix Class Reference

List of all members.

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 ()
SymmetricMatrixoperator= (SymmetricMatrix &Instance)
 Assignment operator '='.
SymmetricMatrixEqual (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.
SymmetricMatrixChs ()
 Changes the signal of the symmetric matrix elements.
SymmetricMatrixoperator- ()
 Changes the signal of the symmetric matrix elements.
SymmetricMatrixAdd (SymmetricMatrix &A, SymmetricMatrix &B)
 Symmetric matrix addition.
SymmetricMatrixoperator+= (SymmetricMatrix &B)
 Symmetric matrix addition.
SymmetricMatrixAdd (SymmetricMatrix &B)
 Symmetric matrix addition.
SymmetricMatrixAdd (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.
SymmetricMatrixSubtract (SymmetricMatrix &A, SymmetricMatrix &B)
 Symmetric matrix subtraction.
SymmetricMatrixoperator-= (SymmetricMatrix &B)
 Symmetric matrix subtraction.
SymmetricMatrixSubtract (SymmetricMatrix &B)
 Symmetric matrix subtraction.
SymmetricMatrixAdd (double Scalar)
 Addition of a scalar in the symmetric matrix.
SymmetricMatrixoperator+= (double Scalar)
 Addition of a scalar in the symmetric matrix.
SymmetricMatrixSubtract (double Scalar)
 Subtraction of a scalar of the symmetric matrix.
SymmetricMatrixoperator-= (double Scalar)
 Subtraction of a scalar of the symmetric matrix.
SymmetricMatrixoperator*= (double Scalar)
 Multiplication of a scalar by the symmetric matrix.
SymmetricMatrixMultiplicate (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).

Constructor & Destructor Documentation

SymmetricMatrix::SymmetricMatrix ( long  MatrixOrder,
double  InitValue = 0.0 
)

Constructor with parameters.

Parameters:
[in]MatrixOrder- The order matrix.
[in]InitValue- The initial value to the matrix.

Constructor with parameters.

Creates the matrix through reading a ASCII data file.

Parameters:
[in]File- A binary file.

Copy constructor.

Parameters:
[in]Instance- symmetric matrix type.

.


Member Function Documentation

Symmetric matrix addition.

Ex.: C.Add(A, B).

Parameters:
[in]A- the symmetric matrix A to be summed.
[in]B- the symmetric matrix B to be summed.
Returns:
a Symmetric Matrix with the sum result of two matrices.

Symmetric matrix addition.

Ex.: A.Add(B).

Parameters:
[in]B- a symmetric matrix to be sum.
Returns:
a Symmetric Matrix with the result of sum the operation "A.Add(B)."
SymmetricMatrix & SymmetricMatrix::Add ( SymmetricMatrix B,
unsigned long  NumEls 
)

Symmetric matrix addition.

Ex.: A.Add(B).

Parameters:
[in]B- a symmetric matrix to be sum.
[in]NumEls- Number of elements of both matrices.
Returns:
a Symmetric Matrix with the result of sum the operation "A.Add(B)."
SymmetricMatrix & SymmetricMatrix::Add ( double  Scalar)

Addition of a scalar in the symmetric matrix.

Ex.: A.Add(10).

Parameters:
[in]Scalar- Scalar value to be added in the symmetric matrix.
Returns:
a Symmetric Matrix with the result of the sum of a symmetric matrix by a scalar.
void SymmetricMatrix::AddMultiplicate ( SymmetricMatrix B,
double  scalar,
unsigned long  NumEls 
)

Symmetric matrix addition and multiplication. It also resets B matrix.

Ex.: A.Add(B).

Parameters:
[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.

Parameters:
[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'.

Parameters:
[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.

Parameters:
[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.
Returns:
a long type indicating if there was convergence.
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.

Parameters:
[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.
Returns:
a long type indicating if there was convergence.
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.

Parameters:
[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.
Returns:
a long type indicating if there was convergence.

Changes the signal of the symmetric matrix elements.

Ex.: A.Chs();

Returns:
a SymmetricMatrix object with the inverted signal.
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.

Parameters:
[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.
Returns:
0 or 1.
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.

Parameters:
[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

Assignment function.

Ex.: A.Equal(B);

Parameters:
[in]Instance- the symmetric matrix type.
Returns:
a object of the SymmetricMatrix.

Returns euclidean norm of the symmetric matrix.

Returns:
a double type with the value of Euclidean Norm.
void SymmetricMatrix::fwdsubst ( double *  vetx,
double *  vetb,
double  omega 
) [protected]

Auxiliary function for gradient method with preconditioning.

Parameters:
[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.

Parameters:
[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.
Returns:
a long type indicating if there was convergence.
void SymmetricMatrix::GaussSolver ( double *  U,
double *  B,
double  Precision 
)

Method to solve system of linear equations.

Gauss Elimination Method.

Parameters:
[in]B- double pointer to independent terms.
[in]Precision.
[out]U- double pointer to answer vector.

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.

Parameters:
[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.

Parameters:
[in]Row- the rows number of symmetric matrix.
[in]Col- the columns number of symmetric matrix.
Returns:
a double type contains a element of the symmetric matrix.

Returns the elements number of symmetric matrix.

Returns:
a unsigned long type with elements number.
unsigned long SymmetricMatrix::GetOrder ( )

Returns the matrix order.

Returns:
a long type with the matrix order.

Returns infinity norm of the symmetric matrix: norm-1 = inifinity norm.

Returns:
a double type with the value of Infinity Norm.
void SymmetricMatrix::Insert ( SymmetricMatrix SubMatrix,
long  InitLine = 0,
long  InitColumn = 0 
)

Inserts a symmetric sub-matrix from the parameters: rows and columns.

Parameters:
[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.

Parameters:
[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.
Returns:
a long type indicating if there was convergence.

Returns the largest element of the symmetric matrix.

Returns:
a double type that indicates the maximum value 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.

Parameters:
[in]*mas- system matrix.
[in]neq- number of equations
[in]step- 'k' step of the proccess of the 'forward elimination'
Returns:
an integer with value '0' or '1' indicating whether the method obtained successful.

Returns the smallest element of the symmetric matrix.

Returns:
a double type that indicates the minimum value of the symmetric matrix.

Multiplication of a scalar by the symmetric matrix.

Ex.: A.Multiplicate(1.5).

Parameters:
[in]Scalar- Scalar value to be multiplied by the symmetric matrix.
Returns:
a Symmetric Matrix with the result of the multiplication of a Symmetric Matrix by a scalar.
void SymmetricMatrix::Multiplicate ( double *  X,
double *  Y 
)

Multiplies the symmetric matrix by a vector: x = A.y.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[in]*u- array of double.
[in]dim- dimension of the array u.
Returns:
a double - the infinity norm of an array.
double SymmetricMatrix::normaev ( double *  u,
long  dim 
) [protected]

Calculate the euclidean norm of a vector.

Parameters:
[in]*u- the vector which will be calculated the euclidean norm.
[in]dim- dimension of vector u.
Returns:
a double - the value of the euclidean norm of a vector.

Returns the norm-1 of the symmetric matrix.

Returns:
a double type with the value of Norm 1.
SymmetricMatrix::operator double *const ( )

Converts from SymmetricMatrix to doulbe*.

Returns:
a pointer to double that stores the elements of the symmetric matrix.
double & SymmetricMatrix::operator() ( long  Row,
long  Col 
)

Accesses the elements of the matrix.

Parameters:
[in]Row- the rows number of symmetric matrix.
[in]Col- the columns number of symmetric matrix.
Returns:
a double type contains a element of the symmetric matrix.
SymmetricMatrix & SymmetricMatrix::operator*= ( double  Scalar)

Multiplication of a scalar by the symmetric matrix.

Ex.: A *= 1.5.

Parameters:
[in]Scalar- Scalar value to be multiplied by the symmetric matrix.
Returns:
a Symmetric Matrix with the result of the multiplication of a Symmetric Matrix by a scalar.
SymmetricMatrix & SymmetricMatrix::operator+= ( SymmetricMatrix B)

Symmetric matrix addition.

Ex.: A += B.

Parameters:
[in]B- a symmetric matrix to be sum.
Returns:
a Symmetric Matrix with the result of the operation "A += B".
SymmetricMatrix & SymmetricMatrix::operator+= ( double  Scalar)

Addition of a scalar in the symmetric matrix.

Ex.: A += 10.

Parameters:
[in]Scalar- Scalar value to be added in the symmetric matrix.
Returns:
a Symmetric Matrix with the result of the sum of a Symmetric Matrix by a scalar.
SymmetricMatrix & SymmetricMatrix::operator- ( )

Changes the signal of the symmetric matrix elements.

Ex.: -A;

Returns:
a SymmetricMatrix object with the inverted signal.
SymmetricMatrix & SymmetricMatrix::operator-= ( SymmetricMatrix B)

Symmetric matrix subtraction.

Ex.: A -= B.

Parameters:
[in]B- The symmetric matrix to be subtracted.
Returns:
a Symmetric Matrix with the result of the subtraction of operation "A -= B"
SymmetricMatrix & SymmetricMatrix::operator-= ( double  Scalar)

Subtraction of a scalar of the symmetric matrix.

Ex.: A -= 10.

Parameters:
[in]Scalar- Scalar value to be subtracted in the symmetric matrix.
Returns:
a Symmetric Matrix with the result of the subtraction of a symmetric matrix by a scalar.
SymmetricMatrix & SymmetricMatrix::operator= ( SymmetricMatrix Instance)

Assignment operator '='.

Ex.: A = B.

Parameters:
[in]-Instance - the symmetric matrix type.
Returns:
a object of the SymmetricMatrix.
double SymmetricMatrix::operator^ ( SymmetricMatrix B)

Scalar product between symmetric matrices.

Ex.: r = A ^ B.

Parameters:
[in]B- The symmetric matrix to be multiplied.
Returns:
a double type with result of multiplication between two symmetric matrices.
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.

Parameters:
[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.

Parameters:
[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").

Parameters:
[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).

Parameters:
[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

Parameters:
[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.

Parameters:
[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.

Parameters:
[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 
)

@ brief: Array multiplication. The size of the array is not necessarily the same of A.

Ex.: C.Product(A, N).

Parameters:
[in]A- Array.
[in]N- Number of rows.
[in]b- Scalar value. the multiplication Atranspose*A of a double *A array.
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.

Parameters:
[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.

Parameters:
[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).

Parameters:
[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").

Parameters:
[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).

Parameters:
[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").

Parameters:
[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.

Scalar product between symmetric matrices.

Ex.: r = A.ScalarProduct(B).

Parameters:
[in]B- The symmetric matrix to be multiplied.
Returns:
a double type with result of multiplication between two symmetric matrices.
double SymmetricMatrix::scalv ( double *  x,
double *  y,
unsigned long  dim 
) [protected]

Calculates the product scalar between two vectors.

Parameters:
[in]*x- first vector.
[in]*y- second vector.
[in]dim- dimension of vector x and y.
Returns:
a double - the value of the product scalar between vectors x and y.
void SymmetricMatrix::SetOrder ( unsigned long  MatrixOrder = 0,
double  InitValue = 0.0 
)

Initializes the matrix order.

Parameters:
[in]MatrixOrder- The order matrix.
[in]InitValue- The initial value to the matrix.

Returns the bytes number occupied by the symmetric matrix.

Returns:
a long type with bytes total of 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.

Parameters:
[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.

Parameters:
[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.
Returns:
a long type indicating if there was convergence.

Symmetric matrix subtraction.

Ex.: C.Subtract(A, B).

Parameters:
[in]A.
[in]B.
Returns:
a Symmetric Matrix with the result of the subtract of A by B.

Symmetric matrix subtraction.

Ex.: A.Subtract(B).

Parameters:
[in]B- The symmetric matrix to be subtracted.
Returns:
a Symmetric Matrix with the result of the subtraction of operation "A.Subtract(B)"

Subtraction of a scalar of the symmetric matrix.

Ex.: A.Subtract(10).

Parameters:
[in]Scalar- Scalar value to be subtracted in the symmetric matrix.
Returns:
a Symmetric Matrix with the result of the subtraction of a symmetric matrix by a scalar

Triple product: "this = At * B * A".

Parameters:
[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".

Parameters:
[in]A- the matrix to be multiplied.
[in]B- the symmetric matrix to be multiplied.

Friends And Related Function Documentation

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).

Parameters:
[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.

Parameters:
[in]A- the symmetric matrix A to be summed.
[in]B- the symmetric matrix B to be summed.
Returns:
a Symmetric Matrix with the sum result of two matrices.
SymmetricMatrix operator- ( SymmetricMatrix A,
SymmetricMatrix B 
) [friend]

Symmetric matrix subtraction.

Ex.: C = A - B.

Parameters:
[in]A.
[in]B.
Returns:
a Symmetric Matrix with the result of the subtract of A by B.

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends Defines