#include <nvectordense.h>
Public Member Functions | |
NVectorDense (unsigned newVectorSize) | |
Creates a new vector. | |
NVectorDense (unsigned newVectorSize, const T &initValue) | |
Creates a new vector and initialises every element to the given value. | |
NVectorDense (const NVector< T > &cloneMe) | |
Creates a new vector that is a clone of the given vector. | |
NVectorDense (const NVectorDense< T > &cloneMe) | |
Creates a new vector that is a clone of the given vector. | |
virtual | ~NVectorDense () |
Destroys this vector. | |
virtual NVector< T > * | clone () const |
Makes a newly allocated clone of this vector. | |
virtual unsigned | size () const |
Returns the number of elements in the vector. | |
virtual const T & | operator[] (unsigned index) const |
Returns the element at the given index in the vector. | |
virtual void | setElement (unsigned index, const T &value) |
Sets the element at the given index in the vector to the given value. | |
virtual void | operator= (const NVector< T > &cloneMe) |
Sets this vector equal to the given vector. | |
virtual void | operator+= (const NVector< T > &other) |
Adds the given vector to this vector. | |
virtual void | operator-= (const NVector< T > &other) |
Subtracts the given vector from this vector. | |
virtual void | operator *= (const T &factor) |
Multiplies this vector by the given scalar. | |
virtual void | negate () |
Negates every element of this vector. | |
virtual void | addCopies (const NVector< T > &other, const T &multiple) |
Adds the given multiple of the given vector to this vector. | |
virtual void | subtractCopies (const NVector< T > &other, const T &multiple) |
Subtracts the given multiple of the given vector to this vector. | |
Protected Attributes | |
T * | elements |
The internal array containing all vector elements. | |
unsigned | vectorSize |
The size of the vector, possibly including zero elements. |
The vector is represented as a simple array on the heap.
regina::NVectorDense< T >::NVectorDense | ( | unsigned | newVectorSize | ) | [inline] |
Creates a new vector.
Its elements will not be initialised.
newVectorSize | the number of elements in the new vector. |
regina::NVectorDense< T >::NVectorDense | ( | unsigned | newVectorSize, | |
const T & | initValue | |||
) | [inline] |
Creates a new vector and initialises every element to the given value.
newVectorSize | the number of elements in the new vector. | |
initValue | the value to assign to every element of the vector. |
regina::NVectorDense< T >::NVectorDense | ( | const NVector< T > & | cloneMe | ) | [inline] |
Creates a new vector that is a clone of the given vector.
cloneMe | the vector to clone. |
regina::NVectorDense< T >::NVectorDense | ( | const NVectorDense< T > & | cloneMe | ) | [inline] |
Creates a new vector that is a clone of the given vector.
cloneMe | the vector to clone. |
virtual regina::NVectorDense< T >::~NVectorDense | ( | ) | [inline, virtual] |
Destroys this vector.
virtual NVector<T>* regina::NVectorDense< T >::clone | ( | ) | const [inline, virtual] |
Makes a newly allocated clone of this vector.
The clone will be of the same subclass of NVector as this vector.
Implements regina::NVector< T >.
Reimplemented in regina::NAngleStructureVector, regina::NRay, regina::NNormalSurfaceVectorANStandard, regina::NNormalSurfaceVectorQuad, and regina::NNormalSurfaceVectorStandard.
virtual unsigned regina::NVectorDense< T >::size | ( | ) | const [inline, virtual] |
Returns the number of elements in the vector.
Implements regina::NVector< T >.
virtual const T& regina::NVectorDense< T >::operator[] | ( | unsigned | index | ) | const [inline, virtual] |
Returns the element at the given index in the vector.
A constant reference to the element is returned; the element may not be altered.
index
is between 0 and size()-1 inclusive.index | the vector index to examine. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::setElement | ( | unsigned | index, | |
const T & | value | |||
) | [inline, virtual] |
Sets the element at the given index in the vector to the given value.
index
is between 0 and size()-1 inclusive.index | the vector index to examine. | |
value | the new value to assign to the element. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::operator= | ( | const NVector< T > & | cloneMe | ) | [inline, virtual] |
Sets this vector equal to the given vector.
cloneMe | the vector whose value shall be assigned to this vector. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::operator+= | ( | const NVector< T > & | other | ) | [inline, virtual] |
Adds the given vector to this vector.
other | the vector to add to this vector. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::operator-= | ( | const NVector< T > & | other | ) | [inline, virtual] |
Subtracts the given vector from this vector.
other | the vector to subtract from this vector. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::operator *= | ( | const T & | factor | ) | [inline, virtual] |
Multiplies this vector by the given scalar.
factor | the scalar with which this will be multiplied. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::negate | ( | ) | [inline, virtual] |
Negates every element of this vector.
Implements regina::NVector< T >.
Reimplemented in regina::NRay.
virtual void regina::NVectorDense< T >::addCopies | ( | const NVector< T > & | other, | |
const T & | multiple | |||
) | [inline, virtual] |
Adds the given multiple of the given vector to this vector.
other | the vector a multiple of which will be added to this vector. | |
multiple | the multiple of other to be added to this vector. |
Implements regina::NVector< T >.
virtual void regina::NVectorDense< T >::subtractCopies | ( | const NVector< T > & | other, | |
const T & | multiple | |||
) | [inline, virtual] |
Subtracts the given multiple of the given vector to this vector.
other | the vector a multiple of which will be subtracted from this vector. | |
multiple | the multiple of other to be subtracted from this vector. |
Implements regina::NVector< T >.
T* regina::NVectorDense< T >::elements [protected] |
The internal array containing all vector elements.
unsigned regina::NVectorDense< T >::vectorSize [protected] |
The size of the vector, possibly including zero elements.