#include <nvectormatrix.h>
Public Member Functions | |
NVectorMatrix (const NMatrix< T > &matrix, unsigned whichRowCol) | |
Creates a new vector that refers to the given row or column of the given matrix. | |
virtual NVector< T > * | clone () const |
Makes a newly allocated clone of this vector. | |
virtual void | setElement (unsigned, const T &) |
Sets the element at the given index in the vector to the given value. | |
virtual void | operator= (const NVector< T > &) |
Sets this vector equal to the given vector. | |
virtual void | operator+= (const NVector< T > &) |
Adds the given vector to this vector. | |
virtual void | operator-= (const NVector< T > &) |
Subtracts the given vector from this vector. | |
virtual void | operator*= (const T &) |
Multiplies this vector by the given scalar. | |
virtual void | negate () |
Negates every element of this vector. | |
virtual void | addCopies (const NVector< T > &, const T &) |
Adds the given multiple of the given vector to this vector. | |
virtual void | subtractCopies (const NVector< T > &, const T &) |
Subtracts the given multiple of the given vector to this vector. | |
Protected Attributes | |
const NMatrix< T > & | source |
The matrix to which this row or column belongs. | |
unsigned | rowCol |
The row or column of the matrix that is this vector. |
Such a vector takes up essentially no storage space, since it merely looks up values in the matrix it references. Because of this, it should never be modified! The modification routines (such as =
, +=
and so on) throw an exception when called. It is recommended to declare any matrix vector as const
for a safeguard.
If the matrix upon which this is vector is based should change, the vector will change accordingly. If it is destroyed, the vector will become invalid and should not be used.
Since a cloned vector might be modified, clone() will return a new NVectorDense instead of a new NVectorMatrix.
regina::NVectorMatrix< T >::NVectorMatrix | ( | const NMatrix< T > & | matrix, | |
unsigned | whichRowCol | |||
) | [inline] |
Creates a new vector that refers to the given row or column of the given matrix.
The subclass of NVectorMatrix being used will determine if it is a row or a column that we are referencing.
matrix.rows() - 1
or matrix.columns() - 1
respectively (between is inclusive).matrix | the matrix to which this row or column belongs. | |
whichRowCol | the row or column of the given matrix that is this vector. |
virtual void regina::NVectorMatrix< 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 NVector<T>* regina::NVectorMatrix< 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 >.
virtual void regina::NVectorMatrix< T >::negate | ( | ) | [inline, virtual] |
virtual void regina::NVectorMatrix< 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::NVectorMatrix< 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::NVectorMatrix< 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::NVectorMatrix< 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::NVectorMatrix< 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::NVectorMatrix< 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 >.
unsigned regina::NVectorMatrix< T >::rowCol [protected] |
The row or column of the matrix that is this vector.
const NMatrix<T>& regina::NVectorMatrix< T >::source [protected] |
The matrix to which this row or column belongs.