Open CASCADE Technology 6.6.0
Public Member Functions | Protected Member Functions | Friends
math_Vector Class Reference

This class implements the real vector abstract data type.
Vectors can have an arbitrary range which must be defined at
the declaration and cannot be changed after this declaration.
math_Vector V1(-3, 5); // a vector with range [-3..5]

Vector are copied through assignement :
math_Vector V2( 1, 9);
....
V2 = V1;
V1(1) = 2.0; // the vector V2 will not be modified.

The Exception RangeError is raised when trying to access outside
the range of a vector :
V1(11) = 0.0 // --> will raise RangeError;

The Exception DimensionError is raised when the dimensions of two
vectors are not compatible :
math_Vector V3(1, 2);
V3 = V1; // --> will raise DimensionError;
V1.Add(V3) // --> will raise DimensionError;

#include <math_Vector.hxx>

Public Member Functions

 math_Vector (const Standard_Integer Lower, const Standard_Integer Upper)
 Contructs a non-initialized vector in the range [Lower..Upper]
Lower and Upper are the indexes of the lower and upper
bounds of the constructed vector.

 math_Vector (const Standard_Integer Lower, const Standard_Integer Upper, const Standard_Real InitialValue)
 Contructs a vector in the range [Lower..Upper]
whose values are all initialized with the value InitialValue..

 math_Vector (const Standard_Address Tab, const Standard_Integer Lower, const Standard_Integer Upper)
 Constructs a vector in the range [Lower..Upper]
with the "c array" Tab.

void Init (const Standard_Real InitialValue)
 Initialize all the elements of a vector with InitialValue.

 math_Vector (const math_Vector &Other)
 Constructs a copy for initialization.
An exception is raised if the lengths of the vectors are
different.

Standard_Integer Length () const
 Returns the length of a vector

Standard_Integer Lower () const
 Returns the value of the Lower index of a vector.

Standard_Integer Upper () const
 Returns the value of the Upper index of a vector.

Standard_Real Norm () const
 Returns the value or the square of the norm of this vector.

Standard_Real Norm2 () const
 Returns the value of the square of the norm of a vector.

Standard_Integer Max () const
 Returns the value of the Index of the maximum element of a vector.

Standard_Integer Min () const
 Returns the value of the Index of the minimum element of a vector.

void Normalize ()
 Normalizes this vector (the norm of the result
is equal to 1.0) and assigns the result to this vector
Exceptions
Standard_NullValue if this vector is null (i.e. if its norm is
less than or equal to Standard_Real::RealEpsilon().

math_Vector Normalized () const
 Normalizes this vector (the norm of the result
is equal to 1.0) and creates a new vector
Exceptions
Standard_NullValue if this vector is null (i.e. if its norm is
less than or equal to Standard_Real::RealEpsilon().

void Invert ()
 Inverts this vector and assigns the result to this vector.

math_Vector Inverse () const
 Inverts this vector and creates a new vector.

void Set (const Standard_Integer I1, const Standard_Integer I2, const math_Vector &V)
 sets a vector from <I1> to <I2> to the vector <V>;
An exception is raised if I1<LowerIndex or I2>UpperIndex or I1>I2.
An exception is raised if I2-I1+1 is different from the Length of V.

math_Vector Slice (const Standard_Integer I1, const Standard_Integer I2) const
 Creates a new vector by inverting the values of this vector
between indexes I1 and I2.
If the values of this vector were (1., 2., 3., 4.,
5., 6.), by slicing it between indexes 2 and 5 the
values of the resulting vector are (1., 5., 4., 3., 2., 6.)

void Multiply (const Standard_Real Right)
 returns the product of a vector and a real value.

void operator*= (const Standard_Real Right)
math_Vector Multiplied (const Standard_Real Right) const
 returns the product of a vector and a real value.

math_Vector operator* (const Standard_Real Right) const
math_Vector TMultiplied (const Standard_Real Right) const
 returns the product of a vector and a real value.

void Divide (const Standard_Real Right)
 divides a vector by the value <Right>.
An exception is raised if <Right> = 0.

void operator/= (const Standard_Real Right)
math_Vector Divided (const Standard_Real Right) const
 divides a vector by the value <Right>.
An exception is raised if <Right> = 0.

math_Vector operator/ (const Standard_Real Right) const
void Add (const math_Vector &Right)
 adds the vector <Right> to a vector.
An exception is raised if the vectors have not the same length.
Warning
In order to avoid time-consuming copying of vectors, it
is preferable to use operator += or the function Add whenever possible.

void operator+= (const math_Vector &Right)
math_Vector Added (const math_Vector &Right) const
 adds the vector <Right> to a vector.
An exception is raised if the vectors have not the same length.
An exception is raised if the lengths are not equal.

math_Vector operator+ (const math_Vector &Right) const
void Multiply (const math_Vector &Left, const math_Matrix &Right)
 sets a vector to the product of the vector <Left>
with the matrix <Right>.

void Multiply (const math_Matrix &Left, const math_Vector &Right)
 sets a vector to the product of the matrix <Left>
with the vector <Right>.

void TMultiply (const math_Matrix &TLeft, const math_Vector &Right)
 sets a vector to the product of the transpose
of the matrix <TLeft> by the vector <Right>.

void TMultiply (const math_Vector &Left, const math_Matrix &TRight)
 sets a vector to the product of the vector
<Left> by the transpose of the matrix <TRight>.

void Add (const math_Vector &Left, const math_Vector &Right)
 sets a vector to the sum of the vector <Left>
and the vector <Right>.
An exception is raised if the lengths are different.

void Subtract (const math_Vector &Left, const math_Vector &Right)
 sets a vector to the Subtraction of the
vector <Right> from the vector <Left>.
An exception is raised if the vectors have not the same length.
Warning
In order to avoid time-consuming copying of vectors, it
is preferable to use operator -= or the function
Subtract whenever possible.

Standard_RealValue (const Standard_Integer Num) const
 accesses (in read or write mode) the value of index Num of
a vector.

Standard_Realoperator() (const Standard_Integer Num) const
math_VectorInitialized (const math_Vector &Other)
 Initialises a vector by copying <Other>.
An exception is raised if the Lengths are differents.

math_Vectoroperator= (const math_Vector &Other)
Standard_Real Multiplied (const math_Vector &Right) const
 returns the inner product of 2 vectors.
An exception is raised if the lengths are not equal.

Standard_Real operator* (const math_Vector &Right) const
math_Vector Multiplied (const math_Matrix &Right) const
 returns the product of a vector by a matrix.

math_Vector operator* (const math_Matrix &Right) const
math_Vector Opposite ()
 returns the opposite of a vector.

math_Vector operator- ()
void Subtract (const math_Vector &Right)
 returns the subtraction of <Right> from <me>.
An exception is raised if the vectors have not the same length.

void operator-= (const math_Vector &Right)
math_Vector Subtracted (const math_Vector &Right) const
 returns the subtraction of <Right> from <me>.
An exception is raised if the vectors have not the same length.

math_Vector operator- (const math_Vector &Right) const
void Multiply (const Standard_Real Left, const math_Vector &Right)
 returns the multiplication of a real by a vector.
<me> = <Left> * <Right>

void Dump (Standard_OStream &o) const
 Prints information on the current state of the object.
Is used to redefine the operator <<.

Protected Member Functions

void SetLower (const Standard_Integer Lower)
 Is used internally to set the Lower value of the vector.

Friends

math_Vector operator* (const Standard_Real Left, const math_Vector &Right)

Constructor & Destructor Documentation

math_Vector::math_Vector ( const Standard_Integer  Lower,
const Standard_Integer  Upper 
)
math_Vector::math_Vector ( const Standard_Integer  Lower,
const Standard_Integer  Upper,
const Standard_Real  InitialValue 
)
math_Vector::math_Vector ( const Standard_Address  Tab,
const Standard_Integer  Lower,
const Standard_Integer  Upper 
)
math_Vector::math_Vector ( const math_Vector Other)

Member Function Documentation

void math_Vector::Add ( const math_Vector Right)
void math_Vector::Add ( const math_Vector Left,
const math_Vector Right 
)
math_Vector math_Vector::Added ( const math_Vector Right) const
void math_Vector::Divide ( const Standard_Real  Right)
math_Vector math_Vector::Divided ( const Standard_Real  Right) const
void math_Vector::Dump ( Standard_OStream o) const
void math_Vector::Init ( const Standard_Real  InitialValue)
math_Vector& math_Vector::Initialized ( const math_Vector Other)
math_Vector math_Vector::Inverse ( ) const
void math_Vector::Invert ( )
Standard_Integer math_Vector::Length ( ) const
Standard_Integer math_Vector::Lower ( ) const
Standard_Integer math_Vector::Max ( ) const
Standard_Integer math_Vector::Min ( ) const
math_Vector math_Vector::Multiplied ( const Standard_Real  Right) const
Standard_Real math_Vector::Multiplied ( const math_Vector Right) const
math_Vector math_Vector::Multiplied ( const math_Matrix Right) const
void math_Vector::Multiply ( const Standard_Real  Left,
const math_Vector Right 
)
void math_Vector::Multiply ( const math_Vector Left,
const math_Matrix Right 
)
void math_Vector::Multiply ( const math_Matrix Left,
const math_Vector Right 
)
void math_Vector::Multiply ( const Standard_Real  Right)
Standard_Real math_Vector::Norm ( ) const
Standard_Real math_Vector::Norm2 ( ) const
void math_Vector::Normalize ( )
math_Vector math_Vector::Normalized ( ) const
Standard_Real& math_Vector::operator() ( const Standard_Integer  Num) const [inline]
math_Vector math_Vector::operator* ( const Standard_Real  Right) const [inline]
Standard_Real math_Vector::operator* ( const math_Vector Right) const [inline]
math_Vector math_Vector::operator* ( const math_Matrix Right) const [inline]
void math_Vector::operator*= ( const Standard_Real  Right) [inline]
math_Vector math_Vector::operator+ ( const math_Vector Right) const [inline]
void math_Vector::operator+= ( const math_Vector Right) [inline]
math_Vector math_Vector::operator- ( ) [inline]
math_Vector math_Vector::operator- ( const math_Vector Right) const [inline]
void math_Vector::operator-= ( const math_Vector Right) [inline]
math_Vector math_Vector::operator/ ( const Standard_Real  Right) const [inline]
void math_Vector::operator/= ( const Standard_Real  Right) [inline]
math_Vector& math_Vector::operator= ( const math_Vector Other) [inline]
math_Vector math_Vector::Opposite ( )
void math_Vector::Set ( const Standard_Integer  I1,
const Standard_Integer  I2,
const math_Vector V 
)
void math_Vector::SetLower ( const Standard_Integer  Lower) [protected]
math_Vector math_Vector::Slice ( const Standard_Integer  I1,
const Standard_Integer  I2 
) const
void math_Vector::Subtract ( const math_Vector Right)
void math_Vector::Subtract ( const math_Vector Left,
const math_Vector Right 
)
math_Vector math_Vector::Subtracted ( const math_Vector Right) const
math_Vector math_Vector::TMultiplied ( const Standard_Real  Right) const
void math_Vector::TMultiply ( const math_Matrix TLeft,
const math_Vector Right 
)
void math_Vector::TMultiply ( const math_Vector Left,
const math_Matrix TRight 
)
Standard_Integer math_Vector::Upper ( ) const
Standard_Real& math_Vector::Value ( const Standard_Integer  Num) const

Friends And Related Function Documentation

math_Vector operator* ( const Standard_Real  Left,
const math_Vector Right 
) [friend]

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines