regina::NVectorMatrix< T > Class Template Reference
[Mathematical Support]

A vector that corresponds to a row or column of a matrix. More...

#include <nvectormatrix.h>

Inheritance diagram for regina::NVectorMatrix< T >:

regina::NVector< T > regina::NVectorMatrixCol< T > regina::NVectorMatrixRow< T >

List of all members.

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.


Detailed Description

template<class T>
class regina::NVectorMatrix< T >

A vector that corresponds to a row or column of a matrix.

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.

Precondition:
See the preconditions for NVector<T>.
Python:
Not present.

Constructor & Destructor Documentation

template<class T>
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.

Precondition:
The given row or column is between 0 and matrix.rows() - 1 or matrix.columns() - 1 respectively (between is inclusive).
Parameters:
matrix the matrix to which this row or column belongs.
whichRowCol the row or column of the given matrix that is this vector.


Member Function Documentation

template<class 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.

Returns:
a clone of this vector.

Implements regina::NVector< T >.

template<class 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.

Precondition:
index is between 0 and size()-1 inclusive.
Parameters:
index the vector index to examine.
value the new value to assign to the element.
Returns:
the vector element at the given index.

Implements regina::NVector< T >.

template<class T>
virtual void regina::NVectorMatrix< T >::operator= ( const NVector< T > &  cloneMe  )  [inline, virtual]

Sets this vector equal to the given vector.

Precondition:
This and the given vector have the same size.
Parameters:
cloneMe the vector whose value shall be assigned to this vector.

Implements regina::NVector< T >.

template<class T>
virtual void regina::NVectorMatrix< T >::operator+= ( const NVector< T > &  other  )  [inline, virtual]

Adds the given vector to this vector.

Precondition:
This and the given vector have the same size.
Parameters:
other the vector to add to this vector.

Implements regina::NVector< T >.

template<class T>
virtual void regina::NVectorMatrix< T >::operator-= ( const NVector< T > &  other  )  [inline, virtual]

Subtracts the given vector from this vector.

Precondition:
This and the given vector have the same size.
Parameters:
other the vector to subtract from this vector.

Implements regina::NVector< T >.

template<class T>
virtual void regina::NVectorMatrix< T >::operator *= ( const T &  factor  )  [inline, virtual]

Multiplies this vector by the given scalar.

Parameters:
factor the scalar with which this will be multiplied.

Implements regina::NVector< T >.

template<class T>
virtual void regina::NVectorMatrix< T >::negate (  )  [inline, virtual]

Negates every element of this vector.

Implements regina::NVector< T >.

template<class T>
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.

Precondition:
This and the given vector have the same size.
Parameters:
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 >.

template<class 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.

Precondition:
This and the given vector have the same size.
Parameters:
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 >.


Member Data Documentation

template<class T>
const NMatrix<T>& regina::NVectorMatrix< T >::source [protected]

The matrix to which this row or column belongs.

template<class T>
unsigned regina::NVectorMatrix< T >::rowCol [protected]

The row or column of the matrix that is this vector.


The documentation for this class was generated from the following file:
Copyright © 1999-2006, Ben Burton
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).