|
| NVector (unsigned newVectorSize) |
| Creates a new vector. More...
|
|
| NVector (unsigned newVectorSize, const T &initValue) |
| Creates a new vector and initialises every element to the given value. More...
|
|
| NVector (const NVector< T > &cloneMe) |
| Creates a new vector that is a clone of the given vector. More...
|
|
| ~NVector () |
| Destroys this vector. More...
|
|
unsigned | size () const |
| Returns the number of elements in the vector. More...
|
|
const T & | operator[] (unsigned index) const |
| Returns the element at the given index in the vector. More...
|
|
void | setElement (unsigned index, const T &value) |
| Sets the element at the given index in the vector to the given value. More...
|
|
bool | operator== (const NVector< T > &compare) const |
| Determines if this vector is equal to the given vector. More...
|
|
NVector< T > & | operator= (const NVector< T > &cloneMe) |
| Sets this vector equal to the given vector. More...
|
|
void | operator+= (const NVector< T > &other) |
| Adds the given vector to this vector. More...
|
|
void | operator-= (const NVector< T > &other) |
| Subtracts the given vector from this vector. More...
|
|
void | operator*= (const T &factor) |
| Multiplies this vector by the given scalar. More...
|
|
T | operator* (const NVector< T > &other) const |
| Calculates the dot product of this vector and the given vector. More...
|
|
void | negate () |
| Negates every element of this vector. More...
|
|
T | norm () const |
| Returns the norm of this vector. More...
|
|
T | elementSum () const |
| Returns the sum of all elements of this vector. More...
|
|
void | addCopies (const NVector< T > &other, const T &multiple) |
| Adds the given multiple of the given vector to this vector. More...
|
|
void | subtractCopies (const NVector< T > &other, const T &multiple) |
| Subtracts the given multiple of the given vector to this vector. More...
|
|
template<class T>
class regina::NVector< T >
An optimised vector class of elements from a given ring T.
Various mathematical vector operations are available.
This class is intended for serious computation, and as a result it has a streamlined implementation with no virtual methods. It can be subclassed, but since there are no virtual methods, type information must generally be known at compile time. Nevertheless, in many respects, different subclasses of NVector<T> can happily interact with one another.
This class is written with bulky types in mind (such as arbitrary precision integers), and so creations and operations are kept to a minimum.
- Warning
- As of Regina 4.90, this class merges the old functionality of NFastVector and the NVector hierarchy from Regina 4.6. As a side-effect, the hierarchy has been compressed into just one class (NVectorUnit, NVectorMatrix and NVectorDense are gone), elements are always stored as dense vectors, and functions are no longer virtual (since the storage model is now fixed). The virtual clone() method is gone completely (since there are no longer virtual functions you should use the copy constructor instead), and the old makeLinComb() method is also gone (just use operator *= and addCopies()).
- Precondition
- Type T has a copy constructor. That is, if
a
and b
are of type T, then a
can be initialised to the value of b
using a(b)
.
-
Type T has a default constructor. That is, an object of type T can be declared with no arguments. No specific default value is required.
-
Type T allows for operators
=
, ==
, +=
, -=
and *=
.
-
Type T has a long integer constructor. That is, if
a
is of type T, then a
can be initialised to a long integer l
using a(l)
.
-
An element
t
of type T can be written to an output stream out
using the standard expression out << t
.
- Python:
- Not present.