hp2FEM
0.1
|
#include <Vector.h>
Public Member Functions | |
Vector () | |
Empty Constructor. | |
Vector (long Dimension, double InitValue=0.0) | |
Constructor with parameters. | |
Vector (Vector &Instance) | |
Copy Constructor. | |
Vector (FILE *File) | |
Constructor. | |
~Vector () | |
Destructor. | |
void | operator= (Vector &Instance) |
Assignment operator '='. | |
void | Equal (Vector &Instance) |
This method assign a vector to another vector. | |
double & | operator[] (long Index) |
Index operator: "operator[]". | |
double & | operator() (long Index) |
Index operator: "operator()". | |
double & | GetElement (unsigned long Index) |
This method accesses a element of the vector. | |
double & | GetEndElement () |
Acess the last element of the vector. | |
operator double *const () | |
Converts the "Vector" to "double*". | |
void | SetOrder (unsigned long VectorOrder=0, double InitValue=0.0) |
Initializes the dimension of the vector. | |
long | GetOrder () |
Returns the vector order. | |
long | SizeOf () |
Returns the bytes number occupied by the vector. | |
void | Reset (double Value=0.0) |
Reinitializes the vector with a value in the "Value" parameter. | |
Vector & | Add (Vector &B, Vector &C) |
Vector & | operator+= (Vector &B) |
Vector & | Add (Vector &B) |
Vector & | Subtract (Vector &B, Vector &C) |
Vector & | operator-= (Vector &B) |
Vector & | Subtract (Vector &B) |
Vector & | VectorialProduct (Vector &B, Vector &C) |
double | operator^ (Vector &B) |
double | ScalarProduct (Vector &B) |
double | ScalarProduct (double *B, unsigned long BDim) |
Scalar product between two vectors. | |
Vector & | operator- () |
Vector & | Chs () |
double | EuclideanNorm () |
Returns the Euclidean Norm. | |
double | InfinityNorm () |
Returns the infinity norm of the vector - maximum absolute value. | |
double | OneNorm () |
double | Maximum () |
double | Minimum () |
Vector & | Multiplicate (double Scalar) |
Vector & | operator*= (double Scalar) |
Vector & | Multiplicate (Matrix &Matrix, Vector &Vect) |
Vector & | Multiplicate (Matrix &Matrix, double *Vect) |
Vector & | TransposeMultiplicate (Matrix &Matrix, Vector &Vect) |
Vector & | TransposeMultiplicate (double *Matrix, unsigned short NLines, Vector &Vect) |
Vector & | Multiplicate (SymmetricMatrix &Matrix, Vector &Vect) |
Vector & | Multiplicate (double *Matrix, double *Vect, unsigned long Dim) |
double | Multiplicate (Vector &Vect, SymmetricMatrix &SymMat) |
Multiplication of the transposed vector by symmetric matrix by the vector: | |
Vector & | UnitVector (Vector &A) |
void | Save (FILE *File) |
void | Save (char *TabName, int Version, char *Filename) |
void | Restore (FILE *File) |
void | Restore (char *TabName, int Version, char *Filename) |
void | Print (FILE *File, const char *Message, char *Format) |
void | Print (FILE *File, const char *Message="", long NumMaxCols=5, int Mant=14, int Dec=7) |
void | Free () |
Protected Member Functions | |
void | Alloc (double InitValue=0.0) |
Allocates memory space to the vector. | |
double | scalv (double *x, double *y, unsigned long dim) |
Calculates the product scalar between two vectors. | |
void | prodmsv (double *vetc, double *ms, double *vet, long ncolms) |
Multiplies an symmetric matrix of the double type stored in the shape supra-diagonal by rows by a vector of the double type stored by row. | |
Protected Attributes | |
unsigned long | Dim |
Dimension of a vector. | |
double * | Vec |
Elements of the vector. | |
Friends | |
Vector | operator+ (Vector &B, Vector &C) |
Plus operator: "operator+". | |
Vector | operator- (Vector &B, Vector &C) |
Vector | operator* (Vector &B, Vector &C) |
Vector | operator* (Matrix &Matrix, Vector &Vect) |
Vector | operator* (SymmetricMatrix &Matrix, Vector &Vect) |
Vector::Vector | ( | long | Dimension, |
double | InitValue = 0.0 |
||
) |
Constructor with parameters.
Allocates vector with the dimension in "Dimension" parameter and with the values in "InitValue" parameter.
[in] | Dimension | - Indicates the size of vector. |
[in] | InitValue | - Value that will be assigned for all elements of vector. |
Vector::Vector | ( | Vector & | Instance | ) |
Copy Constructor.
[in] | Instance | - The vector type used for assign the attributes from a object to another |
Vector::Vector | ( | FILE * | File | ) |
Constructor.
Creates the vector from a ASCII file. This file contains the dimension and elements of the vector.
[in] | File | - A binary file. |
Vector & Vector::Add | ( | Vector & | B, |
Vector & | C | ||
) |
Sums the elements of two vectors. Ex.: VA.Add(VB, VC).
Vector & Vector::Add | ( | Vector & | B | ) |
Sums the elements of two vectors. Ex.: VA.Add(VB).
void Vector::Alloc | ( | double | InitValue = 0.0 | ) | [protected] |
Allocates memory space to the vector.
[in] | InitValue | - Value that will be assigned for all elements of vector. |
Vector & Vector::Chs | ( | ) |
Swaps the signal of the vector elements. Ex.: A.Chs().
void Vector::Equal | ( | Vector & | Instance | ) |
This method assign a vector to another vector.
Ex.: VA.Equal(VB).
[in] | Instance | - The vector type used for assign the attributes from a object to another |
void Vector::Free | ( | ) |
Frees memory area allocated for the vector.
double & Vector::GetElement | ( | unsigned long | Index | ) |
This method accesses a element of the vector.
The index is verified avoiding access the intervals there aren't.
[in] | Index | - The index to access the element of vector. |
double & Vector::GetEndElement | ( | ) |
Acess the last element of the vector.
long Vector::GetOrder | ( | ) |
Returns the vector order.
double Vector::Maximum | ( | ) |
Returns maximum value of the vector.
double Vector::Minimum | ( | ) |
Returns the minimum value of the vector.
Vector & Vector::Multiplicate | ( | double | Scalar | ) |
Multiplies a scalar by the vector: "this *= Scalar" Ex.: A.Multiplicate(1.5)
Vector & Vector::Multiplicate | ( | Matrix & | Matrix, |
Vector & | Vect | ||
) |
Multiplication of a full matrix by the vector: this = Matrix * Vect.
Vector & Vector::Multiplicate | ( | Matrix & | Matrix, |
double * | Vect | ||
) |
Multiplication of a full matrix by the vector: this = Matrix * Vect.
Vector & Vector::Multiplicate | ( | SymmetricMatrix & | Matrix, |
Vector & | Vect | ||
) |
Multiplication of a symmetric matrix by the vector: this = SymmetricMatrix * Vect
Vector & Vector::Multiplicate | ( | double * | Matrix, |
double * | Vect, | ||
unsigned long | Dim | ||
) |
Multiplication between a symmetric matrix allocated as a pointer and a vector allocated as a pointer. this = symmetricmatrix * Vect
double Vector::Multiplicate | ( | Vector & | Vect, |
SymmetricMatrix & | SymMat | ||
) |
Multiplication of the transposed vector by symmetric matrix by the vector:
this = Vect' * SymmetricMatrix * Vect
[in] | Vect | - the vector used in the equation above. The same vector is transposed inside the method. |
[in] | SymMat | - the symmetric matrix |
double Vector::OneNorm | ( | ) |
Returns 1-norm of the vector. Sums the modules of the elements.
double & Vector::operator() | ( | long | Index | ) |
Index operator: "operator()".
Accesses a element of the vector without verify if index there is. Accesses in the following way: "Vector(Index)".
[in] | Index | - The index to access the element of vector. |
Vector & Vector::operator*= | ( | double | Scalar | ) |
Multiplies a scalar by the vector: "this *= Scalar" Ex.: A *= 1.5.
Vector & Vector::operator- | ( | ) |
Swaps the signal of the vector elements. Ex.: -A.
void Vector::operator= | ( | Vector & | Instance | ) |
Assignment operator '='.
Ex.: this = Instance.
[in] | Instance | - The vector type used for assign the attributes from a object to another |
double & Vector::operator[] | ( | long | Index | ) |
Index operator: "operator[]".
Accesses a element of the vector without verify if index there is. Accesses in the following way: "Vector[Index]".
[in] | Index | - The index to access the element of vector. |
double Vector::operator^ | ( | Vector & | B | ) |
Scalar product between two vector: this * A. Ex.: Vr = VB ^ VA.
void Vector::Print | ( | FILE * | File, |
const char * | Message, | ||
char * | Format | ||
) |
Prints the vector in a file. The vector is printed of sequential way in a line. Ex.: A.Print(File, "%7.2f\n"). A.Print(File).
void Vector::Print | ( | FILE * | File, |
const char * | Message = "" , |
||
long | NumMaxCols = 5 , |
||
int | Mant = 14 , |
||
int | Dec = 7 |
||
) |
Prints the vector in the ASCII format considering elements "NumMaxCols" by line.
void Vector::prodmsv | ( | double * | vetc, |
double * | ms, | ||
double * | vet, | ||
long | ncolms | ||
) | [protected] |
Multiplies an symmetric matrix of the double type stored in the shape supra-diagonal by rows by a vector of the double type stored by row.
[out] | *vetc | - pointer to the resulted vector. |
[in] | *ms | - pointer to the symmetric matrix. |
[in] | *vet | - pointer to the vector. |
[in] | ncolms | - number of columns of the symmetric matrix. |
void Vector::Reset | ( | double | Value = 0.0 | ) |
Reinitializes the vector with a value in the "Value" parameter.
[in] | Value | - Value used for reinitializes the vector. |
void Vector::Restore | ( | FILE * | File | ) |
Reads the vector from a binary file.
void Vector::Restore | ( | char * | TabName, |
int | Version, | ||
char * | Filename | ||
) |
Reads the vector from the acdp database.
void Vector::Save | ( | FILE * | File | ) |
Saves the vector in a binary file.
void Vector::Save | ( | char * | TabName, |
int | Version, | ||
char * | Filename | ||
) |
Saves the vector in the 'acdp' database.
double Vector::ScalarProduct | ( | Vector & | B | ) |
Scalar product between two vectors. Ex.: Vr = VA.Scalar(VB);
double Vector::ScalarProduct | ( | double * | B, |
unsigned long | BDim | ||
) |
Scalar product between two vectors.
Ex.: Vr = VA.Scalar(VB);
[in] | B | - A vector that store element of the double type. |
[in] | BDim | - Number of elements of the B vector. |
double Vector::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 Vector::SetOrder | ( | unsigned long | VectorOrder = 0 , |
double | InitValue = 0.0 |
||
) |
Initializes the dimension of the vector.
[in] | VectorOrder | - Indicates the order of vector. |
[in] | InitValue | - The initial value to the vector. |
long Vector::SizeOf | ( | ) |
Returns the bytes number occupied by the vector.
Vector & Vector::Subtract | ( | Vector & | B, |
Vector & | C | ||
) |
Subtracts the elements of two vectors. Ex.: A.Subtract(B, C).
Vector & Vector::Subtract | ( | Vector & | B | ) |
Subtracts the elements of two vectors. Ex.: A.Subtract(B).
Vector & Vector::TransposeMultiplicate | ( | Matrix & | Matrix, |
Vector & | Vect | ||
) |
Multiplication of a full transpose matrix by the vector: this = Matrix' * Vect.
Vector & Vector::TransposeMultiplicate | ( | double * | Matrix, |
unsigned short | NLines, | ||
Vector & | Vect | ||
) |
Multiplication of a full transpose matrix by the vector: this = Matrix' * Vect.
Vector & Vector::UnitVector | ( | Vector & | A | ) |
Unit vector. this = A/|A|
Vector & Vector::VectorialProduct | ( | Vector & | B, |
Vector & | C | ||
) |
Vector product. Ex.: VA.VectorialProduct(VB, VC);
Multiplication of a full matrix by the vector: v = A * u.
Vector operator* | ( | SymmetricMatrix & | Matrix, |
Vector & | Vect | ||
) | [friend] |
Multiplication of a symmetric matrix by the vector. (uses overload of the multiplication operator).
Plus operator: "operator+".
Sums the elements of two vectors. Ex.: VA = VB + VC.
[in] | B | - Input vector to be summed. |
[in] | C | - Input vector to be summed. |
Minus operator. Subtracts the elements of two vectors. Ex.: VA = VB - VC.