Standard class for every vector in Carmen. More...
#include <Vector.h>
Public Member Functions | |
| Vector () | |
| Generates a 1D vector equal to zero. More... | |
| Vector (const int n) | |
| Generates a vector of dimension n, each component being equal to zero. More... | |
| Vector (const real x, const real y) | |
| Generates the 2D vector (x,y). More... | |
| Vector (const real x, const real y, const real z) | |
| Generates the 3D vector (x,y,z). More... | |
| Vector (const Vector &V) | |
| .Generates a copy of the vector V. More... | |
| ~Vector () | |
| Destructor of Vector Class. More... | |
| void | setValue (const int n, const real a) |
| Sets the component n to value a. More... | |
| void | setZero () |
| Sets all the components to zero. More... | |
| void | setDimension (const int n) |
| Sets the dimension of the vector to n and reset values to zero. More... | |
| real | value (const int n) const |
| Returns the value of the component n. More... | |
| int | dimension () const |
| Returns the dimension of the vector. More... | |
| bool | operator== (const Vector &V) const |
| Compares the current vector to a vector V and returns true if they are equal. More... | |
| void | operator= (const Vector &V) |
| Set the current vector to the dimension and the value of V. More... | |
| void | operator+= (const Vector &V) |
| Adds V to the current vector. More... | |
| Vector | operator+ (const Vector &V) const |
| Returns the addition of the current vector and V. More... | |
| void | operator-= (const Vector &V) |
| Subtracts V to the current vector. More... | |
| Vector | operator- (const Vector &V) const |
| Returns the difference between the current vector and V. More... | |
| Vector | operator- () const |
| Returns the opposite of the current vector. More... | |
| void | operator*= (const real a) |
| Multiplies the current vector by a real a. More... | |
| Vector | operator* (const real a) const |
| Returns the product of the current vector and a real a. More... | |
| void | operator/= (const real a) |
| Divides the current vector by a real a. More... | |
| Vector | operator/ (const real a) const |
| Returns the division of the current vector by a real a. More... | |
| real | operator* (const Vector &V) const |
| Returns the dot product of the current vector and V. More... | |
| Vector | operator| (const Vector &V) const |
| Returns the term-by-term product of the current vector and V. More... | |
| Vector | operator^ (const Vector &V) const |
| Returns the vectorial product of the current vector and V. More... | |
| bool | isNaN () const |
| Returns true if one of the components of the current vector is not a number. More... | |
Public Attributes | |
| int | Columns |
| real | U [9] |
Standard class for every vector in Carmen.
It contains the following data:
| Vector::Vector | ( | ) |
| Vector::Vector | ( | const int | n | ) |
Generates a vector of dimension n, each component being equal to zero.
Example :
#include "Vector.h"
Vector V(4);
| n |
| Vector::Vector | ( | const Vector & | V | ) |
| Vector::~Vector | ( | ) |
|
inline |
Returns the dimension of the vector.

| bool Vector::isNaN | ( | ) | const |
Returns true if one of the components of the current vector is not a number.
Returns the product of the current vector and a real a.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W;
real x = 2.;
...
W = V*x;
The operation W = x*V can also be done. See operator*(const real a, const Vector& V).
| a | Real value |
Returns the dot product of the current vector and V.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W(1., 2., 1.);
real x;
...
x = V*W;
| V | Vector |
| void Vector::operator*= | ( | const real | a | ) |
Multiplies the current vector by a real a.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
real x = 2.;
...
V *= x;
| a | Real value |
Returns the addition of the current vector and V.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W(0.,-1.,2.);
Vector U;
...
U = V + W;
| V | Vector |
| void Vector::operator+= | ( | const Vector & | V | ) |
Adds V to the current vector.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W(0.,-1.,2.);
...
W += V;
| V | Vector |
Returns the difference between the current vector and V.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W(0.,-1.,2.);
Vector U;
...
U = V - W;
| V | Vector |
| Vector Vector::operator- | ( | ) | const |
| void Vector::operator-= | ( | const Vector & | V | ) |
Subtracts V to the current vector.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W(0.,-1.,2.);
...
W -= V;
| V | Vector |
| void Vector::operator/= | ( | const real | a | ) |
Divides the current vector by a real a.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
real x = 2.;
...
V /= x;
| a | Real value |
| void Vector::operator= | ( | const Vector & | V | ) |
Set the current vector to the dimension and the value of V.
Example :
#include "Vector.h"
Vector V(1.,0.,0.);
Vector W;
...
W = V;
| V | Vector |
| bool Vector::operator== | ( | const Vector & | V | ) | const |
Compares the current vector to a vector V and returns true if they are equal.
Example :
#include "Vector.h"
Vector V(2);
Vector W(2);
real x;
...
if (V == W)
x = V.value(1);
| V | Vector |
| void Vector::setDimension | ( | const int | n | ) |
Sets the dimension of the vector to n and reset values to zero.
Example :
#include "Vector.h"
Vector V;
...
V.setDimension(3);
| n | Dimension |

|
inline |
Sets the component n to value a.
Example :
#include "Vector.h"
Vector V(2);
real x = 3.;
real y = 1.;
V.setValue(1,x);
V.setValue(2,y);
| n | Variable number |
| a | Real value |

| void Vector::setZero | ( | ) |
Sets all the components to zero.

|
inline |
Returns the value of the component n.
Example :
#include "Vector.h"
Vector V(2);
real x;
real y;
...
x = V.value(1);
y = V.value(2);
| n | Integer |
| int Vector::Columns |
Number of columns
| real Vector::U[9] |
Components
1.8.6