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 (size_t length)  
Creates a new ray all of whose coordinates are initialised to zero. More...  
NRay (const NVector< NLargeInteger > &cloneMe)  
Creates a new ray that is a clone of the given ray. More...  
void  scaleDown () 
Scales this vector down by the greatest common divisor of all its elements. More...  
void  negate () 
Negates every element of this vector. More...  
Public Member Functions inherited from regina::NVector< NLargeInteger >  
NVector (size_t newVectorSize)  
Creates a new vector. More...  
NVector (size_t newVectorSize, const NLargeInteger &initValue)  
Creates a new vector and initialises every element to the given value. More...  
NVector (const NVector< NLargeInteger > &cloneMe)  
Creates a new vector that is a clone of the given vector. More...  
~NVector ()  
Destroys this vector. More...  
size_t  size () const 
Returns the number of elements in the vector. More...  
const NLargeInteger &  operator[] (size_t index) const 
Returns the element at the given index in the vector. More...  
void  setElement (size_t index, const NLargeInteger &value) 
Sets the element at the given index in the vector to the given value. More...  
bool  operator== (const NVector< NLargeInteger > &compare) const 
Determines if this vector is equal to the given vector. More...  
NVector< NLargeInteger > &  operator= (const NVector< NLargeInteger > &cloneMe) 
Sets this vector equal to the given vector. More...  
void  operator+= (const NVector< NLargeInteger > &other) 
Adds the given vector to this vector. More...  
void  operator= (const NVector< NLargeInteger > &other) 
Subtracts the given vector from this vector. More...  
void  operator*= (const NLargeInteger &factor) 
Multiplies this vector by the given scalar. More...  
NLargeInteger  operator* (const NVector< NLargeInteger > &other) const 
Calculates the dot product of this vector and the given vector. More...  
void  negate () 
Negates every element of this vector. More...  
NLargeInteger  norm () const 
Returns the norm of this vector. More...  
NLargeInteger  elementSum () const 
Returns the sum of all elements of this vector. More...  
void  addCopies (const NVector< NLargeInteger > &other, const NLargeInteger &multiple) 
Adds the given multiple of the given vector to this vector. More...  
void  subtractCopies (const NVector< NLargeInteger > &other, const NLargeInteger &multiple) 
Subtracts the given multiple of the given vector to this vector. More...  
Additional Inherited Members  
Static Public Attributes inherited from regina::NVector< NLargeInteger >  
static NLargeInteger  zero 
Zero in the underlying number system. More...  
static NLargeInteger  one 
One in the underlying number system. More...  
static NLargeInteger  minusOne 
Negative one in the underlying number system. More...  
Protected Attributes inherited from regina::NVector< NLargeInteger >  
NLargeInteger *  elements 
The internal array containing all vector elements. More...  
NLargeInteger *  end 
A pointer just beyond the end of the internal array. More...  
A fast class for storing a ray rooted at the origin whose coordinates are rational.
Such a ray is a halfline 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.
This is an optimised implementation that overrides NVector<NLargeInteger>::negate().
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.