|
Open CASCADE Technology
6.7.1
|
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;
More...
#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] <br> Lower and Upper are the indexes of the lower and upper | |
| 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.. More... | |
| 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. More... | |
| void | Init (const Standard_Real InitialValue) |
| Initialize all the elements of a vector with InitialValue. More... | |
| math_Vector (const math_Vector &Other) | |
| Constructs a copy for initialization. An exception is raised if the lengths of the vectors are different. More... | |
| Standard_Integer | Length () const |
| Returns the length of a vector More... | |
| Standard_Integer | Lower () const |
| Returns the value of the Lower index of a vector. More... | |
| Standard_Integer | Upper () const |
| Returns the value of the Upper index of a vector. More... | |
| Standard_Real | Norm () const |
| Returns the value or the square of the norm of this vector. More... | |
| Standard_Real | Norm2 () const |
| Returns the value of the square of the norm of a vector. More... | |
| Standard_Integer | Max () const |
| Returns the value of the Index of the maximum element of a vector. More... | |
| Standard_Integer | Min () const |
| Returns the value of the Index of the minimum element of a vector. More... | |
| void | Normalize () |
Normalizes this vector (the norm of the result <br> is equal to 1.0) and assigns the result to this vector | |
| math_Vector | Normalized () const |
Normalizes this vector (the norm of the result <br> is equal to 1.0) and creates a new vector | |
| void | Invert () |
| Inverts this vector and assigns the result to this vector. More... | |
| math_Vector | Inverse () const |
| Inverts this vector and creates a new vector. More... | |
| 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>; <br> An exception is raised if I1<LowerIndex or I2>UpperIndex or I1>I2. | |
| math_Vector | Slice (const Standard_Integer I1, const Standard_Integer I2) const |
Creates a new vector by inverting the values of this vector <br> between indexes I1 and I2. | |
| void | Multiply (const Standard_Real Right) |
| returns the product of a vector and a real value. More... | |
| void | operator*= (const Standard_Real Right) |
| math_Vector | Multiplied (const Standard_Real Right) const |
| returns the product of a vector and a real value. More... | |
| 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. More... | |
| void | Divide (const Standard_Real Right) |
divides a vector by the value <Right>. <br> 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>. <br> 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. <br> An exception is raised if the vectors have not the same length. | |
| void | operator+= (const math_Vector &Right) |
| math_Vector | Added (const math_Vector &Right) const |
adds the vector <Right> to a vector. <br> An exception is raised if the vectors have not the same length. | |
| 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>. More... | |
| void | Multiply (const math_Matrix &Left, const math_Vector &Right) |
| sets a vector to the product of the matrix <Left> with the vector <Right>. More... | |
| 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>. More... | |
| 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>. More... | |
| void | Add (const math_Vector &Left, const math_Vector &Right) |
sets a vector to the sum of the vector <Left> <br>
and the vector <Right>. <br>
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 <br>
vector <Right> from the vector <Left>. <br>
An exception is raised if the vectors have not the same length. | |
| Standard_Real & | Value (const Standard_Integer Num) const |
| accesses (in read or write mode) the value of index Num of a vector. More... | |
| Standard_Real & | operator() (const Standard_Integer Num) const |
| math_Vector & | Initialized (const math_Vector &Other) |
| Initialises a vector by copying <Other>. An exception is raised if the Lengths are differents. More... | |
| math_Vector & | operator= (const math_Vector &Other) |
| Standard_Real | Multiplied (const math_Vector &Right) const |
returns the inner product of 2 vectors. <br> 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. More... | |
| math_Vector | operator* (const math_Matrix &Right) const |
| math_Vector | Opposite () |
| returns the opposite of a vector. More... | |
| math_Vector | operator- () |
| void | Subtract (const math_Vector &Right) |
returns the subtraction of <Right> from <me>. <br> 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>. <br> 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> More... | |
| void | Dump (Standard_OStream &o) const |
| Prints information on the current state of the object. Is used to redefine the operator <<. More... | |
Protected Member Functions | |
| void | SetLower (const Standard_Integer Lower) |
| Is used internally to set the Lower value of the vector. More... | |
Friends | |
| math_Vector | operator* (const Standard_Real Left, const math_Vector &Right) |
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;
| math_Vector::math_Vector | ( | const Standard_Integer | Lower, |
| const Standard_Integer | Upper | ||
| ) |
Contructs a non-initialized vector in the range [Lower..Upper] <br>
Lower and Upper are the indexes of the lower and upper
bounds of the constructed vector.
| math_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::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.
| math_Vector::math_Vector | ( | const math_Vector & | Other | ) |
Constructs a copy for initialization.
An exception is raised if the lengths of the vectors are
different.
| void math_Vector::Add | ( | const math_Vector & | Right | ) |
adds the vector <Right> to a vector. <br>
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 math_Vector::Add | ( | const math_Vector & | Left, |
| const math_Vector & | Right | ||
| ) |
sets a vector to the sum of the vector <Left> <br>
and the vector <Right>. <br>
An exception is raised if the lengths are different.
| math_Vector math_Vector::Added | ( | const math_Vector & | Right | ) | const |
adds the vector <Right> to a vector. <br>
An exception is raised if the vectors have not the same length.
An exception is raised if the lengths are not equal.
| void math_Vector::Divide | ( | const Standard_Real | Right | ) |
divides a vector by the value <Right>. <br>
An exception is raised if <Right> = 0.
| math_Vector math_Vector::Divided | ( | const Standard_Real | Right | ) | const |
divides a vector by the value <Right>. <br>
An exception is raised if <Right> = 0.
| void math_Vector::Dump | ( | Standard_OStream & | o | ) | const |
Prints information on the current state of the object.
Is used to redefine the operator <<.
| void math_Vector::Init | ( | const Standard_Real | InitialValue | ) |
Initialize all the elements of a vector with InitialValue.
| math_Vector& math_Vector::Initialized | ( | const math_Vector & | Other | ) |
Initialises a vector by copying <Other>.
An exception is raised if the Lengths are differents.
| math_Vector math_Vector::Inverse | ( | ) | const |
Inverts this vector and creates a new vector.
| void math_Vector::Invert | ( | ) |
Inverts this vector and assigns the result to this vector.
| Standard_Integer math_Vector::Length | ( | ) | const |
Returns the length of a vector
| Standard_Integer math_Vector::Lower | ( | ) | const |
Returns the value of the Lower index of a vector.
| Standard_Integer math_Vector::Max | ( | ) | const |
Returns the value of the Index of the maximum element of a vector.
| Standard_Integer math_Vector::Min | ( | ) | const |
Returns the value of the Index of the minimum element of a vector.
| math_Vector math_Vector::Multiplied | ( | const Standard_Real | Right | ) | const |
returns the product of a vector and a real value.
| Standard_Real math_Vector::Multiplied | ( | const math_Vector & | Right | ) | const |
returns the inner product of 2 vectors. <br>
An exception is raised if the lengths are not equal.
| math_Vector math_Vector::Multiplied | ( | const math_Matrix & | Right | ) | const |
returns the product of a vector by a matrix.
| void math_Vector::Multiply | ( | const Standard_Real | Right | ) |
returns the product of a vector and a real value.
| void math_Vector::Multiply | ( | const math_Vector & | Left, |
| const math_Matrix & | Right | ||
| ) |
sets a vector to the product of the vector <Left>
with the matrix <Right>.
| void math_Vector::Multiply | ( | const math_Matrix & | Left, |
| const math_Vector & | Right | ||
| ) |
sets a vector to the product of the matrix <Left>
with the vector <Right>.
| void math_Vector::Multiply | ( | const Standard_Real | Left, |
| const math_Vector & | Right | ||
| ) |
returns the multiplication of a real by a vector.
<me> = <Left> * <Right>
| Standard_Real math_Vector::Norm | ( | ) | const |
Returns the value or the square of the norm of this vector.
| Standard_Real math_Vector::Norm2 | ( | ) | const |
Returns the value of the square of the norm of a vector.
| void math_Vector::Normalize | ( | ) |
Normalizes this vector (the norm of the result <br>
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 math_Vector::Normalized | ( | ) | const |
Normalizes this vector (the norm of the result <br>
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().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| math_Vector math_Vector::Opposite | ( | ) |
returns the opposite of a vector.
| void math_Vector::Set | ( | const Standard_Integer | I1, |
| const Standard_Integer | I2, | ||
| const math_Vector & | V | ||
| ) |
sets a vector from <I1> to <I2> to the vector <V>; <br>
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.
|
protected |
Is used internally to set the Lower value of the vector.
| math_Vector math_Vector::Slice | ( | const Standard_Integer | I1, |
| const Standard_Integer | I2 | ||
| ) | const |
Creates a new vector by inverting the values of this vector <br>
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 math_Vector::Subtract | ( | const math_Vector & | Left, |
| const math_Vector & | Right | ||
| ) |
sets a vector to the Subtraction of the <br>
vector <Right> from the vector <Left>. <br>
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.
| void math_Vector::Subtract | ( | const math_Vector & | Right | ) |
returns the subtraction of <Right> from <me>. <br>
An exception is raised if the vectors have not the same length.
| math_Vector math_Vector::Subtracted | ( | const math_Vector & | Right | ) | const |
returns the subtraction of <Right> from <me>. <br>
An exception is raised if the vectors have not the same length.
| math_Vector math_Vector::TMultiplied | ( | const Standard_Real | Right | ) | const |
returns the product of a vector and a real value.
| void math_Vector::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 math_Vector::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>.
| Standard_Integer math_Vector::Upper | ( | ) | const |
Returns the value of the Upper index of a vector.
| Standard_Real& math_Vector::Value | ( | const Standard_Integer | Num | ) | const |
accesses (in read or write mode) the value of index Num of
a vector.
|
friend |
1.8.5