#include <rvector.h>
Public Member Functions | |
int | Compare (const RVector &vector) const |
RNumCursor< double > | GetCols (size_t min=0, size_t max=SIZE_MAX) const |
size_t | GetNb (void) const |
virtual void | Init (double val=0.0) |
bool | IsIn (double value) const |
bool | IsSame (const RVector &vector) const |
RVector & | operator*= (const double arg) |
RVector & | operator+= (const RVector &vector) |
RVector & | operator-= (const RVector &vector) |
RVector & | operator/= (const double arg) |
RVector & | operator= (const RVector &src) |
double | operator[] (size_t i) const |
double & | operator[] (size_t i) |
template<class S > | |
void | Print (S &stream, const RString &name, const char *format="%E", size_t colsize=12) const |
void | Randomize (RRandom *rand, size_t nb=0) |
void | ReOrder (void) |
void | ReSize (size_t size, double val=0.0) |
RVector (size_t size) | |
RVector (const RVector &vector) | |
virtual | ~RVector (void) |
Additional Inherited Members | |
Private Member Functions inherited from RNumContainer< double, false > | |
RNumContainer< double, false > & | Add (const RNumContainer< double, bOrder1 > &src) |
void | Clear (void) |
int | Compare (const RNumContainer< double, false > &) const |
void | Delete (doubledel) |
void | DeleteAt (size_t pos, bool shift=true) |
size_t | GetIndex (doublenb, bool &find) const |
const double * | GetList (void) const |
size_t | GetNb (void) const |
void | Init (size_t nb, doubleval) |
size_t | Insert (doubleins) |
void | InsertAt (doubleins, size_t pos, bool replace=false) |
void | Inter (const RNumContainer< double, bOrder1 > &src1, const RNumContainer< double, bOrder2 > &src2) |
bool | IsIn (doublevalue) const |
bool | IsSame (const RNumContainer &vi) const |
RNumContainer & | operator= (const RNumContainer< double, bOrder1 > &src) |
double | operator[] (size_t i) const |
double & | operator[] (size_t i) |
void | Randomize (RRandom *rand, size_t nb=0) |
void | ReOrder (void) |
RNumContainer (const RNumContainer &vector) | |
RNumContainer (size_t max) | |
void | Union (const RNumContainer< double, bOrder1 > &src1, const RNumContainer< double, bOrder2 > &src2) |
void | Verify (size_t max) |
~RNumContainer (void) | |
Private Attributes inherited from RNumContainer< double, false > | |
double * | List |
size_t | MaxInt |
size_t | NbInt |
Detailed Description
The RVector class provides a representation for a vector. It is a specialized class inheriting from RNumContainer since a vector is supposed to have a fixed size.
Constructor & Destructor Documentation
RVector | ( | size_t | size | ) |
Construct a vector.
- Parameters
-
size Size of the vector.
|
virtual |
Destruct the vector.
Member Function Documentation
int Compare | ( | const RVector & | vector | ) | const |
|
virtual |
Initialize all the elements of the vector to a given value.
- Parameters
-
val Value to assign.
void ReSize | ( | size_t | size, |
double | val = 0.0 |
||
) |
Resize the size of the vector. If the new size is smaller than the old one, the unused memory space is only released when the vector is destruct,
- Parameters
-
size Size of the vector. val Value to assign to the new elements created.
bool IsSame | ( | const RVector & | vector | ) | const |
Test if two vectors have exactly the same values.
- Parameters
-
vector Vector used for the comparison.
- Returns
- True if the vectors are the same.
bool IsIn | ( | double | value | ) | const |
Verify if a value is in the vector.
- Parameters
-
value Value to test.
- Returns
- True if the value is in the vector, false else.
void ReOrder | ( | void | ) |
Reorder the vector in ascending order.
void Randomize | ( | RRandom * | rand, |
size_t | nb = 0 |
||
) |
Randomize the vector.
- Parameters
-
rand Random number generator to use. nb Number of first element to randomize. If null, all values are randomized.
Assignment operator.
- Parameters
-
src Vector used for the assignment.
RNumCursor<double> GetCols | ( | size_t | min = 0 , |
size_t | max = SIZE_MAX |
||
) | const |
Get the values corresponding to the vector.
- Parameters
-
min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (max included). If SIZE_MAX, iterate until the end of the container.
- Returns
- Cursor over the numbers.
double operator[] | ( | size_t | i | ) | const |
Return the value at position i. The first value is at position 0.
- Parameters
-
i Index.
double& operator[] | ( | size_t | i | ) |
Return the value at position i. The first value is at position 0.
- Parameters
-
i Index.
size_t GetNb | ( | void | ) | const |
Get the number of values in the list.
- Returns
- size_t
Add a vector to the current one.
- Parameters
-
vector Vector to add.
Subtract a vector from the current one.
- Parameters
-
vector Vector to subtract.
RVector& operator*= | ( | const double | arg | ) |
Multiply a vector with a given number.
- Parameters
-
arg Number.
RVector& operator/= | ( | const double | arg | ) |
Divide a vector with a given number.
- Parameters
-
arg Number.
void Print | ( | S & | stream, |
const RString & | name, | ||
const char * | format = "%E" , |
||
size_t | colsize = 12 |
||
) | const |
Print the content of the vector.
- Template Parameters
-
S Stream class that implements the << operator.
- Parameters
-
stream Stream. name Name of the vector. format Format used to print the number. By default, it is "%E". colsize Size of a column. By default, it is 12.