Template vector class. May filled with elements of TRing. Vectorsize is shrinked to size_t. More...
#include <TVector.h>
Public Types | |
typedef TRing::ElementType | TNum |
TRing element type. | |
Public Member Functions | |
Constructors, Destructor | |
TVector (size_t _size, const TRing *_ring, string _name="unnamedVector") | |
Creates a zero TVector of size size with elements in _ring. (vector[i] = TNum::Zero, i is in 0,..,(size-1). | |
template<class _istream > | |
TVector (const TRing *_ring, _istream &_vectorStream, string _name="unnamedVector") | |
Creates TVector from a stream, with elements in _ring. Currently only integer entries are supported. Required stream format style is like : {1,22,33,...}. | |
TVector (string _vectorStr, const TRing *_ring, string _name="unnamedVector") | |
Creates TVector from a string, with elements in _ring. Currently only integer entries are supported. Required string format style is like : {1,22,33,...}. | |
virtual | ~TVector () |
properties | |
size_t | getSize () const |
get vector size | |
string | getName () const |
void | setName (string _name) |
const TRing * | getRing () const |
initialising | |
void | fillZero () |
fill all elements with TNum::Zero | |
void | randomInit (long *_pRandomSeed) |
Init all entries with random TRing elements. _pZufallSeed has to point to a random seed, which is used by ran2() random generator randomInit. Only implemented for (ring1->getEpsPrecision==0). | |
value access | |
TNum & | operator[] (const size_t pos) |
TNum | getVal (const size_t _pos) const |
_pos is 0-based! | |
const TNum & | getConstValRef (const size_t _pos) const |
_pos is 0-based! | |
TNum & | getValRef (const size_t _pos) |
_pos is 0-based! | |
void | setVal (const size_t _pos, const TNum _z) |
_pos is 0-based! | |
void | setValByRef (const size_t _pos, const TNum &_z) |
_pos is 0-based! | |
operators | |
bool | isZero () const |
checks if vector is zero | |
bool | isNotZero () const |
checks if vector is zero | |
bool | operator== (TVector &vec) const |
bool | operator!= (TVector &vec) const |
IO | |
void | outputAsMatrix (ostream &_os) |
output vector in Macaulay style ( "name = value ; " ) | |
Protected Member Functions | |
Construction | |
template<class _istream > | |
void | createFromStream (_istream &_vectorStream) |
/// Reads a vector from a stream. Currently, createFromStream() works only for vectors with integer elements. Required format style is {1,22,33,...} | |
Safety | |
void | checkBounds (size_t pos) const |
Private Attributes | |
const TRing * | ring |
pointer to an object with operations on TRing elements TNum. | |
size_t | size |
vector dimension | |
TNum * | data |
vector data | |
string | name |
object name |
add static ring pointer to TNum class?
operator[] implementieren?
Definition at line 25 of file TVector.h.
TVector< TRing >::TVector | ( | size_t | _size, | |
const TRing * | _ring, | |||
string | _name = "unnamedVector" | |||
) | [inline] |
_size | vector size | |
_ring | a ring operating on TNum-numbers. | |
_name | name for the current object |
Definition at line 12 of file TVector.cpp.
References TVector< TRing >::data, TVector< TRing >::fillZero(), and TVector< TRing >::size.
TVector< TRing >::TVector | ( | const TRing * | _ring, | |
_istream & | _vectorStream, | |||
string | _name = "unnamedVector" | |||
) | [inline] |
Definition at line 88 of file TVector.cpp.
TVector< TRing >::TVector | ( | string | _vectorStr, | |
const TRing * | _ring, | |||
string | _name = "unnamedVector" | |||
) | [inline] |
Definition at line 100 of file TVector.cpp.
Definition at line 110 of file TVector.cpp.
References TVector< TRing >::data.
void TVector< TRing >::checkBounds | ( | size_t | pos | ) | const [inline, protected] |
Definition at line 120 of file TVector.cpp.
References TVector< TRing >::size.
Referenced by TVector< TRing >::getConstValRef(), TVector< TRing >::getVal(), TVector< TRing >::getValRef(), TVector< TRing >::operator[](), and TVector< TRing >::setVal().
void TVector< TRing >::createFromStream | ( | _istream & | _dataStream | ) | [inline, protected] |
implement StreamIn-Operator for TNum !;
nur istream verwenden, und statt <iostream> nur <iosfwd> im header einbinden
auftretende Fehler werden nicht
Definition at line 37 of file TVector.cpp.
References countElements(), countGroups(), TVector< TRing >::data, extractChar(), extractNextBracedData(), TVector< TRing >::ring, and TVector< TRing >::size.
void TVector< TRing >::fillZero | ( | ) | [inline] |
Definition at line 136 of file TVector.cpp.
References TVector< TRing >::data, and TVector< TRing >::size.
Referenced by TVector< TRing >::TVector().
const TRing::ElementType & TVector< TRing >::getConstValRef | ( | const size_t | _pos | ) | const [inline] |
Definition at line 198 of file TVector.cpp.
References TVector< TRing >::checkBounds(), and TVector< TRing >::data.
string TVector< TRing >::getName | ( | ) | const [inline] |
Definition at line 69 of file TVector.h.
References TVector< TRing >::name.
const TRing* TVector< TRing >::getRing | ( | ) | const [inline] |
Definition at line 71 of file TVector.h.
References TVector< TRing >::ring.
size_t TVector< TRing >::getSize | ( | ) | const [inline] |
Definition at line 129 of file TVector.cpp.
References TVector< TRing >::size.
Referenced by nCenterFocus::CenterFocusExperiment< variant >::liftTest_performSingleTest(), TVector< TRing >::operator!=(), TMatrix< TRing >::operator*(), TVector< TRing >::operator==(), and TMatrix< TRing >::TMatrix().
TRing::ElementType TVector< TRing >::getVal | ( | const size_t | _pos | ) | const [inline] |
Definition at line 178 of file TVector.cpp.
References TVector< TRing >::checkBounds(), and TVector< TRing >::data.
Referenced by Matrix3D< TMatrix2D >::computeFrontalMatrixBasis(), TMatrix< TRing >::getRowBasis(), TVector< TRing >::operator!=(), TMatrix< TRing >::operator*(), TVector< TRing >::operator==(), and TMatrix< TRing >::TMatrix().
TRing::ElementType & TVector< TRing >::getValRef | ( | const size_t | _pos | ) | [inline] |
Definition at line 188 of file TVector.cpp.
References TVector< TRing >::checkBounds(), and TVector< TRing >::data.
Referenced by nCenterFocus::CenterFocusExperiment< variant >::liftTest_performSingleTest().
bool TVector< TRing >::isNotZero | ( | ) | const [inline] |
Definition at line 239 of file TVector.cpp.
References TVector< TRing >::data, and TVector< TRing >::size.
Referenced by Matrix3D< TMatrix2D >::computeFrontalMatrixBasis(), TMatrix< TRing >::getRowBasis(), and TVector< TRing >::isZero().
bool TVector< TRing >::isZero | ( | ) | const [inline] |
Definition at line 228 of file TVector.cpp.
References TVector< TRing >::data, TVector< TRing >::isNotZero(), and TVector< TRing >::size.
Definition at line 264 of file TVector.cpp.
References TVector< TRing >::getSize(), TVector< TRing >::getVal(), and TVector< TRing >::size.
Definition at line 250 of file TVector.cpp.
References TVector< TRing >::getSize(), TVector< TRing >::getVal(), and TVector< TRing >::size.
TRing::ElementType & TVector< TRing >::operator[] | ( | const size_t | pos | ) | [inline] |
Definition at line 149 of file TVector.cpp.
References TVector< TRing >::checkBounds(), and TVector< TRing >::data.
void TVector< TRing >::outputAsMatrix | ( | ostream & | _os | ) | [inline] |
Definition at line 279 of file TVector.cpp.
References TVector< TRing >::data, TVector< TRing >::name, and TVector< TRing >::size.
void TVector< TRing >::randomInit | ( | long * | _pRandomInit | ) | [inline] |
/
Definition at line 216 of file TVector.cpp.
References TVector< TRing >::data, random(), TVector< TRing >::ring, and TVector< TRing >::size.
void TVector< TRing >::setName | ( | string | _name | ) | [inline] |
Definition at line 70 of file TVector.h.
References TVector< TRing >::name.
Referenced by Matrix3D< TMatrix2D >::computeFrontalMatrixBasis().
Definition at line 158 of file TVector.cpp.
References TVector< TRing >::checkBounds(), and TVector< TRing >::data.
Referenced by nCenterFocus::CenterFocusExperiment< variant >::complementColumns(), TMatrix< TRing >::convertToVector(), TMatrix< TRing >::getColAsVector(), TMatrix< TRing >::getRowAsVector(), TMatrix< TRing >::getTrace(), and TMatrix< TRing >::operator*().
void TVector< TRing >::setValByRef | ( | const size_t | _pos, | |
const TNum & | _z | |||
) | [inline] |
Definition at line 34 of file TVector.h.
Referenced by TVector< TRing >::createFromStream(), TVector< TRing >::fillZero(), TVector< TRing >::getConstValRef(), TVector< TRing >::getVal(), TVector< TRing >::getValRef(), TVector< TRing >::isNotZero(), TVector< TRing >::isZero(), TVector< TRing >::operator[](), TVector< TRing >::outputAsMatrix(), TVector< TRing >::randomInit(), TVector< TRing >::setVal(), TVector< TRing >::TVector(), and TVector< TRing >::~TVector().
Definition at line 36 of file TVector.h.
Referenced by TVector< TRing >::getName(), TVector< TRing >::outputAsMatrix(), and TVector< TRing >::setName().
Definition at line 31 of file TVector.h.
Referenced by TVector< TRing >::createFromStream(), TVector< TRing >::getRing(), and TVector< TRing >::randomInit().
Definition at line 33 of file TVector.h.
Referenced by TVector< TRing >::checkBounds(), TVector< TRing >::createFromStream(), TVector< TRing >::fillZero(), TVector< TRing >::getSize(), TVector< TRing >::isNotZero(), TVector< TRing >::isZero(), TVector< TRing >::operator!=(), TVector< TRing >::operator==(), TVector< TRing >::outputAsMatrix(), TVector< TRing >::randomInit(), and TVector< TRing >::TVector().