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

Class Vector. More...

#include <Vector.h>

List of all members.

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.
VectorAdd (Vector &B, Vector &C)
Vectoroperator+= (Vector &B)
VectorAdd (Vector &B)
VectorSubtract (Vector &B, Vector &C)
Vectoroperator-= (Vector &B)
VectorSubtract (Vector &B)
VectorVectorialProduct (Vector &B, Vector &C)
double operator^ (Vector &B)
double ScalarProduct (Vector &B)
double ScalarProduct (double *B, unsigned long BDim)
 Scalar product between two vectors.
Vectoroperator- ()
VectorChs ()
double EuclideanNorm ()
 Returns the Euclidean Norm.
double InfinityNorm ()
 Returns the infinity norm of the vector - maximum absolute value.
double OneNorm ()
double Maximum ()
double Minimum ()
VectorMultiplicate (double Scalar)
Vectoroperator*= (double Scalar)
VectorMultiplicate (Matrix &Matrix, Vector &Vect)
VectorMultiplicate (Matrix &Matrix, double *Vect)
VectorTransposeMultiplicate (Matrix &Matrix, Vector &Vect)
VectorTransposeMultiplicate (double *Matrix, unsigned short NLines, Vector &Vect)
VectorMultiplicate (SymmetricMatrix &Matrix, Vector &Vect)
VectorMultiplicate (double *Matrix, double *Vect, unsigned long Dim)
double Multiplicate (Vector &Vect, SymmetricMatrix &SymMat)
 Multiplication of the transposed vector by symmetric matrix by the vector:
VectorUnitVector (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)

Detailed Description

Class Vector.

Used for operation on Vector.


Constructor & Destructor Documentation

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.

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

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

Parameters:
[in]File- A binary file.

Member Function Documentation

Vector & Vector::Add ( Vector B,
Vector C 
)

Sums the elements of two vectors. Ex.: VA.Add(VB, VC).

Sums the elements of two vectors. Ex.: VA.Add(VB).

void Vector::Alloc ( double  InitValue = 0.0) [protected]

Allocates memory space to the vector.

Parameters:
[in]InitValue- Value that will be assigned for all elements of vector.

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

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

Parameters:
[in]Index- The index to access the element of vector.
double & Vector::GetEndElement ( )

Acess the last element of the vector.

Returns:
a double - the last element of vector
long Vector::GetOrder ( )

Returns the vector order.

Returns:
a long typ with the order of vector.
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

Parameters:
[in]Vect- the vector used in the equation above. The same vector is transposed inside the method.
[in]SymMat- the symmetric matrix
Returns:
a double - result of the equation above.
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)".

Parameters:
[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+= ( Vector B)

Sums the elements of two vectors. Ex.: VA += VB.

Vector & Vector::operator- ( )

Swaps the signal of the vector elements. Ex.: -A.

Vector & Vector::operator-= ( Vector B)

Subtracts the elements of two vectors. Ex.: A -= B.

void Vector::operator= ( Vector Instance)

Assignment operator '='.

Ex.: this = Instance.

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

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

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

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

Parameters:
[in]B- A vector that store element of the double type.
[in]BDim- Number of elements of the B vector.
Returns:
a double with the result of the scalar product between Vec (class attribute) and B Vector.
double Vector::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 Vector::SetOrder ( unsigned long  VectorOrder = 0,
double  InitValue = 0.0 
)

Initializes the dimension of the vector.

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

Returns:
a long type with the bytes number occupied by vector.
Vector & Vector::Subtract ( Vector B,
Vector C 
)

Subtracts the elements of two vectors. Ex.: A.Subtract(B, C).

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.

Unit vector. this = A/|A|

Vector product. Ex.: VA.VectorialProduct(VB, VC);


Friends And Related Function Documentation

Vector operator* ( Vector B,
Vector C 
) [friend]

Vector product. Ex.: VA = VB * VC.

Vector operator* ( Matrix Matrix,
Vector Vect 
) [friend]

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

Vector operator+ ( Vector B,
Vector C 
) [friend]

Plus operator: "operator+".

Sums the elements of two vectors. Ex.: VA = VB + VC.

Parameters:
[in]B- Input vector to be summed.
[in]C- Input vector to be summed.
Returns:
a vector type with result vector of the summ between two vectors.
Vector operator- ( Vector B,
Vector C 
) [friend]

Minus operator. Subtracts the elements of two vectors. Ex.: VA = VB - VC.


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