~ubuntu-branches/ubuntu/vivid/regina-normal/vivid-proposed

« back to all changes in this revision

Viewing changes to engine/maths/nfastray.h

  • Committer: Package Import Robot
  • Author(s): Ben Burton
  • Date: 2011-09-10 07:17:25 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: package-import@ubuntu.com-20110910071725-97n90tywdq60w2cr
Tags: 4.90-1
* New upstream release!
* The user interface has been ported from KDE3 to KDE4 (closes: #556318).
  Re-enabled the GUI as a result.
* The build system has been ported from autotools to cmake.
* The new upstream release builds fine on amd64 (closes: #624882).
* Moved the users' handbook into regina-normal-doc.
* Upgraded several suggests/recommends.  Upgraded regina-normal-mpi to
  depend on mpi-default-bin, and regina-normal to depend on both graphviz
  and regina-normal-doc (which the GUI expends to be present).  Upgraded
  regina-normal to recommend gap.
* Bumped standards-version to 3.9.2.0 (no changes required).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/**************************************************************************
3
 
 *                                                                        *
4
 
 *  Regina - A Normal Surface Theory Calculator                           *
5
 
 *  Computational Engine                                                  *
6
 
 *                                                                        *
7
 
 *  Copyright (c) 1999-2009, Ben Burton                                   *
8
 
 *  For further details contact Ben Burton (bab@debian.org).              *
9
 
 *                                                                        *
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.                       *
14
 
 *                                                                        *
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.                              *
19
 
 *                                                                        *
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.                                                   *
24
 
 *                                                                        *
25
 
 **************************************************************************/
26
 
 
27
 
/* end stub */
28
 
 
29
 
/*! \file nray.h
30
 
 *  \brief Provides a fast but inflexible rational ray class for heavy
31
 
 *  computation.
32
 
 */
33
 
 
34
 
#ifndef __NFASTRAY_H
35
 
#ifndef __DOXYGEN
36
 
#define __NFASTRAY_H
37
 
#endif
38
 
 
39
 
#include "maths/nfastvector.h"
40
 
#include "maths/nlargeinteger.h"
41
 
 
42
 
namespace regina {
43
 
 
44
 
/**
45
 
 * \weakgroup maths
46
 
 * @{
47
 
 */
48
 
 
49
 
/**
50
 
 * A fast but inflexible class storing a ray rooted at the origin whose
51
 
 * coordinates are rational.
52
 
 *
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.
58
 
 *
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.
63
 
 *
64
 
 * \ifacespython Not present.
65
 
 */
66
 
class NFastRay : public NFastVector<NLargeInteger> {
67
 
    public:
68
 
        /**
69
 
         * Creates a new ray all of whose coordinates are initialised to zero.
70
 
         *
71
 
         * @param length the number of elements in the new vector.
72
 
         */
73
 
        NFastRay(unsigned length);
74
 
        /**
75
 
         * Creates a new ray that is a clone of the given ray.
76
 
         *
77
 
         * @param cloneMe the ray to clone.
78
 
         */
79
 
        NFastRay(const NFastVector<NLargeInteger>& cloneMe);
80
 
 
81
 
        /**
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.
86
 
         *
87
 
         * This routine thus reduces a ray to its smallest possible
88
 
         * representation.
89
 
         *
90
 
         * This routine poses no problem for vectors containing infinite
91
 
         * elements; such elements are simply ignored and left at
92
 
         * infinity.
93
 
         */
94
 
        void scaleDown();
95
 
};
96
 
 
97
 
/*@}*/
98
 
 
99
 
// Inline functions for NFastRay
100
 
 
101
 
inline NFastRay::NFastRay(unsigned length) : NFastVector<NLargeInteger>(
102
 
        length) {
103
 
    // Don't bother passing zero to the parent constructor, since the
104
 
    // default NLargeInteger constructor already sets elements to zero.
105
 
}
106
 
 
107
 
inline NFastRay::NFastRay(const NFastVector<NLargeInteger>& cloneMe) :
108
 
        NFastVector<NLargeInteger>(cloneMe) {
109
 
}
110
 
 
111
 
} // namespace regina
112
 
 
113
 
#endif
114