Regina Calculation Engine
|
A fast class for storing a ray rooted at the origin whose coordinates are rational. More...
#include <maths/nray.h>
Public Member Functions | |
NRay (unsigned length) | |
Creates a new ray all of whose coordinates are initialised to zero. | |
NRay (const NVector< NLargeInteger > &cloneMe) | |
Creates a new ray that is a clone of the given ray. | |
void | scaleDown () |
Scales this vector down by the greatest common divisor of all its elements. | |
void | negate () |
Negates every element of this vector. | |
![]() | |
NVector (unsigned newVectorSize) | |
Creates a new vector. | |
NVector (unsigned newVectorSize, const NLargeInteger &initValue) | |
Creates a new vector and initialises every element to the given value. | |
NVector (const NVector< NLargeInteger > &cloneMe) | |
Creates a new vector that is a clone of the given vector. | |
~NVector () | |
Destroys this vector. | |
unsigned | size () const |
Returns the number of elements in the vector. | |
const NLargeInteger & | operator[] (unsigned index) const |
Returns the element at the given index in the vector. | |
void | setElement (unsigned index, const NLargeInteger &value) |
Sets the element at the given index in the vector to the given value. | |
bool | operator== (const NVector< NLargeInteger > &compare) const |
Determines if this vector is equal to the given vector. | |
NVector< NLargeInteger > & | operator= (const NVector< NLargeInteger > &cloneMe) |
Sets this vector equal to the given vector. | |
void | operator+= (const NVector< NLargeInteger > &other) |
Adds the given vector to this vector. | |
void | operator-= (const NVector< NLargeInteger > &other) |
Subtracts the given vector from this vector. | |
void | operator*= (const NLargeInteger &factor) |
Multiplies this vector by the given scalar. | |
NLargeInteger | operator* (const NVector< NLargeInteger > &other) const |
Calculates the dot product of this vector and the given vector. | |
NLargeInteger | norm () const |
Returns the norm of this vector. | |
NLargeInteger | elementSum () const |
Returns the sum of all elements of this vector. | |
void | addCopies (const NVector< NLargeInteger > &other, const NLargeInteger &multiple) |
Adds the given multiple of the given vector to this vector. | |
void | subtractCopies (const NVector< NLargeInteger > &other, const NLargeInteger &multiple) |
Subtracts the given multiple of the given vector to this vector. |
Additional Inherited Members | |
![]() | |
static NLargeInteger | zero |
Zero in the underlying number system. | |
static NLargeInteger | one |
One in the underlying number system. | |
static NLargeInteger | minusOne |
Negative one in the underlying number system. | |
![]() | |
NLargeInteger * | elements |
The internal array containing all vector elements. | |
NLargeInteger * | end |
A pointer just beyond the end of the internal array. |
A fast class for storing a ray rooted at the origin whose coordinates are rational.
Such a ray is a half-line beginning at the origin and is represented by an integer point that it passes through. Positive scalar multiples of a ray are considered to represent the same ray.
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 NRay can happily interact with one another.
|
inline |
Creates a new ray all of whose coordinates are initialised to zero.
length | the number of elements in the new vector. |
|
inline |
Creates a new ray that is a clone of the given ray.
cloneMe | the ray to clone. |
|
inline |
Negates every element of this vector.
Reimplemented from regina::NVector< NLargeInteger >.
void regina::NRay::scaleDown | ( | ) |
Scales this vector down by the greatest common divisor of all its elements.
The resulting vector will be the smallest multiple of the original that maintains integral entries, and these entries will have the same signs as the originals.
This routine thus reduces a ray to its smallest possible representation.
This routine poses no problem for vectors containing infinite elements; such elements are simply ignored and left at infinity.