Open CASCADE Technology
7.6.0

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. More...
#include <math_Vector.hxx>
Public Member Functions  
math_Vector (const Standard_Integer theLower, const Standard_Integer theUpper)  
Constructs a noninitialized vector in the range [theLower..theUpper] "theLower" and "theUpper" are the indexes of the lower and upper bounds of the constructed vector. More...  
math_Vector (const Standard_Integer theLower, const Standard_Integer theUpper, const Standard_Real theInitialValue)  
Constructs a vector in the range [theLower..theUpper] whose values are all initialized with the value "theInitialValue". More...  
math_Vector (const Standard_Real *theTab, const Standard_Integer theLower, const Standard_Integer theUpper)  
Constructs a vector in the range [theLower..theUpper] with the "c array" theTab. More...  
math_Vector (const gp_XY &Other)  
Constructor for converting gp_XY to math_Vector. More...  
math_Vector (const gp_XYZ &Other)  
Constructor for converting gp_XYZ to math_Vector. More...  
void  Init (const Standard_Real theInitialValue) 
Initialize all the elements of a vector with "theInitialValue". More...  
math_Vector (const math_Vector &theOther)  
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 theLower index of a vector. More...  
Standard_Integer  Upper () const 
Returns the value of the theUpper 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 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(). More...  
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(). More...  
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 theI1, const Standard_Integer theI2, const math_Vector &theV) 
sets a vector from "theI1" to "theI2" to the vector "theV"; An exception is raised if "theI1" is less than "LowerIndex" or "theI2" is greater than "UpperIndex" or "theI1" is greater than "theI2". An exception is raised if "theI2theI1+1" is different from the "Length" of "theV". More...  
math_Vector  Slice (const Standard_Integer theI1, const Standard_Integer theI2) const 
Creates a new vector by inverting the values of this vector between indexes "theI1" and "theI2". 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.) More...  
void  Multiply (const Standard_Real theRight) 
returns the product of a vector and a real value. More...  
void  operator*= (const Standard_Real theRight) 
math_Vector  Multiplied (const Standard_Real theRight) const 
returns the product of a vector and a real value. More...  
math_Vector  operator* (const Standard_Real theRight) const 
math_Vector  TMultiplied (const Standard_Real theRight) const 
returns the product of a vector and a real value. More...  
void  Divide (const Standard_Real theRight) 
divides a vector by the value "theRight". An exception is raised if "theRight" = 0. More...  
void  operator/= (const Standard_Real theRight) 
math_Vector  Divided (const Standard_Real theRight) const 
divides a vector by the value "theRight". An exception is raised if "theRight" = 0. More...  
math_Vector  operator/ (const Standard_Real theRight) const 
void  Add (const math_Vector &theRight) 
adds the vector "theRight" to a vector. An exception is raised if the vectors have not the same length. Warning In order to avoid timeconsuming copying of vectors, it is preferable to use operator += or the function Add whenever possible. More...  
void  operator+= (const math_Vector &theRight) 
math_Vector  Added (const math_Vector &theRight) const 
adds the vector theRight 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. More...  
math_Vector  operator+ (const math_Vector &theRight) const 
void  Multiply (const math_Vector &theLeft, const math_Matrix &theRight) 
sets a vector to the product of the vector "theLeft" with the matrix "theRight". More...  
void  Multiply (const math_Matrix &theLeft, const math_Vector &theRight) 
sets a vector to the product of the matrix "theLeft" with the vector "theRight". More...  
void  TMultiply (const math_Matrix &theTLeft, const math_Vector &theRight) 
sets a vector to the product of the transpose of the matrix "theTLeft" by the vector "theRight". More...  
void  TMultiply (const math_Vector &theLeft, const math_Matrix &theTRight) 
sets a vector to the product of the vector "theLeft" by the transpose of the matrix "theTRight". More...  
void  Add (const math_Vector &theLeft, const math_Vector &theRight) 
sets a vector to the sum of the vector "theLeft" and the vector "theRight". An exception is raised if the lengths are different. More...  
void  Subtract (const math_Vector &theLeft, const math_Vector &theRight) 
sets a vector to the Subtraction of the vector theRight from the vector theLeft. An exception is raised if the vectors have not the same length. Warning In order to avoid timeconsuming copying of vectors, it is preferable to use operator = or the function Subtract whenever possible. More...  
const Standard_Real &  Value (const Standard_Integer theNum) const 
accesses the value of index "theNum" of a vector. More...  
Standard_Real &  Value (const Standard_Integer theNum) 
accesses (in read or write mode) the value of index "theNum" of a vector. More...  
const Standard_Real &  operator() (const Standard_Integer theNum) const 
Standard_Real &  operator() (const Standard_Integer theNum) 
math_Vector &  Initialized (const math_Vector &theOther) 
Initialises a vector by copying "theOther". An exception is raised if the Lengths are different. More...  
math_Vector &  operator= (const math_Vector &theOther) 
Standard_Real  Multiplied (const math_Vector &theRight) const 
returns the inner product of 2 vectors. An exception is raised if the lengths are not equal. More...  
Standard_Real  operator* (const math_Vector &theRight) const 
math_Vector  Multiplied (const math_Matrix &theRight) const 
returns the product of a vector by a matrix. More...  
math_Vector  operator* (const math_Matrix &theRight) const 
math_Vector  Opposite () 
returns the opposite of a vector. More...  
math_Vector  operator () 
void  Subtract (const math_Vector &theRight) 
returns the subtraction of "theRight" from "me". An exception is raised if the vectors have not the same length. More...  
void  operator= (const math_Vector &theRight) 
math_Vector  Subtracted (const math_Vector &theRight) const 
returns the subtraction of "theRight" from "me". An exception is raised if the vectors have not the same length. More...  
math_Vector  operator (const math_Vector &theRight) const 
void  Multiply (const Standard_Real theLeft, const math_Vector &theRight) 
returns the multiplication of a real by a vector. "me" = "theLeft" * "theRight" More...  
void  Dump (Standard_OStream &theO) 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 theLower) 
Is used internally to set the "theLower" value of the vector. More...  
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.
Vector are copied through assignment:
The Exception RangeError is raised when trying to access outside the range of a vector :
The Exception DimensionError is raised when the dimensions of two vectors are not compatible :
math_Vector::math_Vector  (  const Standard_Integer  theLower, 
const Standard_Integer  theUpper  
) 
Constructs a noninitialized vector in the range [theLower..theUpper] "theLower" and "theUpper" are the indexes of the lower and upper bounds of the constructed vector.
math_Vector::math_Vector  (  const Standard_Integer  theLower, 
const Standard_Integer  theUpper,  
const Standard_Real  theInitialValue  
) 
Constructs a vector in the range [theLower..theUpper] whose values are all initialized with the value "theInitialValue".
math_Vector::math_Vector  (  const Standard_Real *  theTab, 
const Standard_Integer  theLower,  
const Standard_Integer  theUpper  
) 
Constructs a vector in the range [theLower..theUpper] with the "c array" theTab.
math_Vector::math_Vector  (  const gp_XY &  Other  ) 
Constructor for converting gp_XY to math_Vector.
math_Vector::math_Vector  (  const gp_XYZ &  Other  ) 
Constructor for converting gp_XYZ to math_Vector.
math_Vector::math_Vector  (  const math_Vector &  theOther  ) 
Constructs a copy for initialization. An exception is raised if the lengths of the vectors are different.
void math_Vector::Add  (  const math_Vector &  theLeft, 
const math_Vector &  theRight  
) 
sets a vector to the sum of the vector "theLeft" and the vector "theRight". An exception is raised if the lengths are different.
void math_Vector::Add  (  const math_Vector &  theRight  ) 
adds the vector "theRight" to a vector. An exception is raised if the vectors have not the same length. Warning In order to avoid timeconsuming copying of vectors, it is preferable to use operator += or the function Add whenever possible.
math_Vector math_Vector::Added  (  const math_Vector &  theRight  )  const 
adds the vector theRight 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.
void math_Vector::Divide  (  const Standard_Real  theRight  ) 
divides a vector by the value "theRight". An exception is raised if "theRight" = 0.
math_Vector math_Vector::Divided  (  const Standard_Real  theRight  )  const 
divides a vector by the value "theRight". An exception is raised if "theRight" = 0.
void math_Vector::Dump  (  Standard_OStream &  theO  )  const 
Prints information on the current state of the object. Is used to redefine the operator <<.
void math_Vector::Init  (  const Standard_Real  theInitialValue  ) 
Initialize all the elements of a vector with "theInitialValue".
math_Vector& math_Vector::Initialized  (  const math_Vector &  theOther  ) 
Initialises a vector by copying "theOther". An exception is raised if the Lengths are different.
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.

inline 
Returns the length of a vector.

inline 
Returns the value of the theLower 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 math_Matrix &  theRight  )  const 
returns the product of a vector by a matrix.
Standard_Real math_Vector::Multiplied  (  const math_Vector &  theRight  )  const 
returns the inner product of 2 vectors. An exception is raised if the lengths are not equal.
math_Vector math_Vector::Multiplied  (  const Standard_Real  theRight  )  const 
returns the product of a vector and a real value.
void math_Vector::Multiply  (  const math_Matrix &  theLeft, 
const math_Vector &  theRight  
) 
sets a vector to the product of the matrix "theLeft" with the vector "theRight".
void math_Vector::Multiply  (  const math_Vector &  theLeft, 
const math_Matrix &  theRight  
) 
sets a vector to the product of the vector "theLeft" with the matrix "theRight".
void math_Vector::Multiply  (  const Standard_Real  theLeft, 
const math_Vector &  theRight  
) 
returns the multiplication of a real by a vector. "me" = "theLeft" * "theRight"
void math_Vector::Multiply  (  const Standard_Real  theRight  ) 
returns the product of a vector and a real value.
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 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 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 

inline 
math_Vector math_Vector::Opposite  (  ) 
returns the opposite of a vector.
void math_Vector::Set  (  const Standard_Integer  theI1, 
const Standard_Integer  theI2,  
const math_Vector &  theV  
) 
sets a vector from "theI1" to "theI2" to the vector "theV"; An exception is raised if "theI1" is less than "LowerIndex" or "theI2" is greater than "UpperIndex" or "theI1" is greater than "theI2". An exception is raised if "theI2theI1+1" is different from the "Length" of "theV".

protected 
Is used internally to set the "theLower" value of the vector.
math_Vector math_Vector::Slice  (  const Standard_Integer  theI1, 
const Standard_Integer  theI2  
)  const 
Creates a new vector by inverting the values of this vector between indexes "theI1" and "theI2". 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 &  theLeft, 
const math_Vector &  theRight  
) 
sets a vector to the Subtraction of the vector theRight from the vector theLeft. An exception is raised if the vectors have not the same length. Warning In order to avoid timeconsuming copying of vectors, it is preferable to use operator = or the function Subtract whenever possible.
void math_Vector::Subtract  (  const math_Vector &  theRight  ) 
returns the subtraction of "theRight" from "me". An exception is raised if the vectors have not the same length.
math_Vector math_Vector::Subtracted  (  const math_Vector &  theRight  )  const 
returns the subtraction of "theRight" from "me". An exception is raised if the vectors have not the same length.
math_Vector math_Vector::TMultiplied  (  const Standard_Real  theRight  )  const 
returns the product of a vector and a real value.
void math_Vector::TMultiply  (  const math_Matrix &  theTLeft, 
const math_Vector &  theRight  
) 
sets a vector to the product of the transpose of the matrix "theTLeft" by the vector "theRight".
void math_Vector::TMultiply  (  const math_Vector &  theLeft, 
const math_Matrix &  theTRight  
) 
sets a vector to the product of the vector "theLeft" by the transpose of the matrix "theTRight".

inline 
Returns the value of the theUpper index of a vector.

inline 
accesses (in read or write mode) the value of index "theNum" of a vector.

inline 
accesses the value of index "theNum" of a vector.