2
/**************************************************************************
4
* Regina - A Normal Surface Theory Calculator *
5
* Computational Engine *
7
* Copyright (c) 1999-2009, Ben Burton *
8
* For further details contact Ben Burton (bab@debian.org). *
10
* This program is free software; you can redistribute it and/or *
11
* modify it under the terms of the GNU General Public License as *
12
* published by the Free Software Foundation; either version 2 of the *
13
* License, or (at your option) any later version. *
15
* This program is distributed in the hope that it will be useful, but *
16
* WITHOUT ANY WARRANTY; without even the implied warranty of *
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18
* General Public License for more details. *
20
* You should have received a copy of the GNU General Public *
21
* License along with this program; if not, write to the Free *
22
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
23
* MA 02110-1301, USA. *
25
**************************************************************************/
30
* \brief Provides a fast but inflexible rational ray class for heavy
39
#include "maths/nfastvector.h"
40
#include "maths/nlargeinteger.h"
50
* A fast but inflexible class storing a ray rooted at the origin whose
51
* coordinates are rational.
53
* This class is similar to NRay but is better suited to heavy
54
* computation. Like its base class NFastVector, it has a streamlined
55
* implementation with no virtual methods, but it cannot talk easily to
56
* any vector class other than itself. For a slower but more flexible
57
* ray class, see the NRay hierarchy instead.
59
* As with the NRay class, the ray described by this class is a
60
* half-line beginning at the origin, represented by an integer point that
61
* it passes through. Positive scalar multiples of a ray are considered to
62
* represent the same ray.
64
* \ifacespython Not present.
66
class NFastRay : public NFastVector<NLargeInteger> {
69
* Creates a new ray all of whose coordinates are initialised to zero.
71
* @param length the number of elements in the new vector.
73
NFastRay(unsigned length);
75
* Creates a new ray that is a clone of the given ray.
77
* @param cloneMe the ray to clone.
79
NFastRay(const NFastVector<NLargeInteger>& cloneMe);
82
* Scales this vector down by the greatest common divisor of all
83
* its elements. The resulting vector will be the smallest
84
* multiple of the original that maintains integral entries, and
85
* these entries will have the same signs as the originals.
87
* This routine thus reduces a ray to its smallest possible
90
* This routine poses no problem for vectors containing infinite
91
* elements; such elements are simply ignored and left at
99
// Inline functions for NFastRay
101
inline NFastRay::NFastRay(unsigned length) : NFastVector<NLargeInteger>(
103
// Don't bother passing zero to the parent constructor, since the
104
// default NLargeInteger constructor already sets elements to zero.
107
inline NFastRay::NFastRay(const NFastVector<NLargeInteger>& cloneMe) :
108
NFastVector<NLargeInteger>(cloneMe) {
111
} // namespace regina