DGtal  0.9.2
SternBrocot.cpp
1 
32 #include "DGtal/arithmetic/SternBrocot.h"
35 
36 #include <iostream>
37 
38 
40 // class Common
42 
46 namespace DGtal
47 {
48  template <typename TInteger, typename TQuotient>
51 
52  template <>
53  SternBrocot<DGtal::int32_t,DGtal::int32_t>*
55 
56  template <>
59 
60  template <>
63 
64 #ifdef WITH_BIGINTEGER
65  template <>
68 
69  template <>
72 
73  template <>
76 
77 #endif
78 
79 // template<>
80 // DGtal::SternBrocot<int32_t,int32_t>::Quotient
81 // DGtal::SternBrocot<int32_t,int32_t>::nbFractions = 0;
82 // template<>
83 // DGtal::SternBrocot<int64_t,int32_t>::Quotient
84 // DGtal::SternBrocot<int64_t,int32_t>::nbFractions = 0;
85 // template<>
86 // DGtal::SternBrocot<int64_t,int64_t>::Quotient
87 // DGtal::SternBrocot<int64_t,int64_t>::nbFractions = 0;
88 
89 // // Constant definitions in SternBrocot specializations.
90 // // DGtal::SternBrocot<int32_t,int32_t>
91 // template<>
92 // DGtal::SternBrocot<int32_t,int32_t>::Node
93 // DGtal::SternBrocot<int32_t,int32_t>::myVirtualZeroOverOne
94 // ( 0, 1, 0, -2,
95 // 0, 0, 0, &myOneOverZero,
96 // &myOneOverZero );
97 
98 // template<>
99 // DGtal::SternBrocot<int32_t,int32_t>::Node
100 // DGtal::SternBrocot<int32_t,int32_t>::myOneOverZero
101 // ( 1, 0, 0, -1,
102 // // &myVirtualZeroOverOne, 0, &myOneOverOne, 0,
103 // &myZeroOverOne, 0, &myOneOverOne, 0,
104 // &myZeroOverOne );
105 
106 // template<>
107 // DGtal::SternBrocot<int32_t,int32_t>::Node
108 // DGtal::SternBrocot<int32_t,int32_t>::myZeroOverOne
109 // ( 0, 1, 0, 0,
110 // // &myVirtualZeroOverOne, &myOneOverZero,
111 // &myZeroOverOne, &myOneOverZero,
112 // 0, &myOneOverOne,
113 // &myOneOverZero );
114 
115 // template<>
116 // DGtal::SternBrocot<int32_t,int32_t>::Node
117 // DGtal::SternBrocot<int32_t,int32_t>::myOneOverOne
118 // ( 1, 1, 1, 0,
119 // &myZeroOverOne, &myOneOverZero, 0, 0,
120 // &myOneOverOne );
121 
122 // // Constant definitions in SternBrocot specializations.
123 // // DGtal::SternBrocot<int64_t,int32_t>
124 // template<>
125 // DGtal::SternBrocot<int64_t,int32_t>::Node
126 // DGtal::SternBrocot<int64_t,int32_t>::myVirtualZeroOverOne
127 // ( 0, 1, 0, -2,
128 // 0, 0, 0, &myOneOverZero,
129 // &myOneOverZero );
130 
131 // template<>
132 // DGtal::SternBrocot<int64_t,int32_t>::Node
133 // DGtal::SternBrocot<int64_t,int32_t>::myOneOverZero
134 // ( 1, 0, 0, -1,
135 // // &myVirtualZeroOverOne, 0, &myOneOverOne, 0,
136 // &myZeroOverOne, 0, &myOneOverOne, 0,
137 // &myZeroOverOne );
138 
139 // template<>
140 // DGtal::SternBrocot<int64_t,int32_t>::Node
141 // DGtal::SternBrocot<int64_t,int32_t>::myZeroOverOne
142 // ( 0, 1, 0, 0,
143 // // &myVirtualZeroOverOne, &myOneOverZero,
144 // &myZeroOverOne, &myOneOverZero,
145 // 0, &myOneOverOne,
146 // &myOneOverZero );
147 
148 // template<>
149 // DGtal::SternBrocot<int64_t,int32_t>::Node
150 // DGtal::SternBrocot<int64_t,int32_t>::myOneOverOne
151 // ( 1, 1, 1, 0,
152 // &myZeroOverOne, &myOneOverZero, 0, 0,
153 // &myOneOverOne );
154 
155 // // Constant definitions in SternBrocot specializations.
156 // // DGtal::SternBrocot<int64_t,int64_t>
157 // template<>
158 // DGtal::SternBrocot<int64_t,int64_t>::Node
159 // DGtal::SternBrocot<int64_t,int64_t>::myVirtualZeroOverOne
160 // ( 0, 1, 0, -2,
161 // 0, 0, 0, &myOneOverZero,
162 // &myOneOverZero );
163 
164 // template<>
165 // DGtal::SternBrocot<int64_t,int64_t>::Node
166 // DGtal::SternBrocot<int64_t,int64_t>::myOneOverZero
167 // ( 1, 0, 0, -1,
168 // // &myVirtualZeroOverOne, 0, &myOneOverOne, 0,
169 // &myZeroOverOne, 0, &myOneOverOne, 0,
170 // &myZeroOverOne );
171 
172 // template<>
173 // DGtal::SternBrocot<int64_t,int64_t>::Node
174 // DGtal::SternBrocot<int64_t,int64_t>::myZeroOverOne
175 // ( 0, 1, 0, 0,
176 // // &myVirtualZeroOverOne, &myOneOverZero,
177 // &myZeroOverOne, &myOneOverZero,
178 // 0, &myOneOverOne,
179 // &myOneOverZero );
180 
181 // template<>
182 // DGtal::SternBrocot<int64_t,int64_t>::Node
183 // DGtal::SternBrocot<int64_t,int64_t>::myOneOverOne
184 // ( 1, 1, 1, 0,
185 // &myZeroOverOne, &myOneOverZero, 0, 0,
186 // &myOneOverOne );
187 
188 // #ifdef WITH_BIGINTEGER
189 // template<>
190 // DGtal::SternBrocot<BigInteger,int64_t>::Quotient
191 // DGtal::SternBrocot<BigInteger,int64_t>::nbFractions = 0;
192 // template<>
193 // DGtal::SternBrocot<BigInteger,int32_t>::Quotient
194 // DGtal::SternBrocot<BigInteger,int32_t>::nbFractions = 0;
195 // template<>
196 // DGtal::SternBrocot<BigInteger,BigInteger>::Quotient
197 // DGtal::SternBrocot<BigInteger,BigInteger>::nbFractions = 0;
198 
199 // // Constant definitions in SternBrocot specializations.
200 // // DGtal::SternBrocot<BigInteger,int64_t>
201 // template<>
202 // DGtal::SternBrocot<BigInteger,int64_t>::Node
203 // DGtal::SternBrocot<BigInteger,int64_t>::myVirtualZeroOverOne
204 // ( 0, 1, 0, -2,
205 // 0, 0, 0, &myOneOverZero,
206 // &myOneOverZero );
207 
208 // template<>
209 // DGtal::SternBrocot<BigInteger,int64_t>::Node
210 // DGtal::SternBrocot<BigInteger,int64_t>::myOneOverZero
211 // ( 1, 0, 0, -1,
212 // // &myVirtualZeroOverOne, 0, &myOneOverOne, 0,
213 // &myZeroOverOne, 0, &myOneOverOne, 0,
214 // &myZeroOverOne );
215 
216 // template<>
217 // DGtal::SternBrocot<BigInteger,int64_t>::Node
218 // DGtal::SternBrocot<BigInteger,int64_t>::myZeroOverOne
219 // ( 0, 1, 0, 0,
220 // // &myVirtualZeroOverOne, &myOneOverZero,
221 // &myZeroOverOne, &myOneOverZero,
222 // 0, &myOneOverOne,
223 // &myOneOverZero );
224 
225 // template<>
226 // DGtal::SternBrocot<BigInteger,int64_t>::Node
227 // DGtal::SternBrocot<BigInteger,int64_t>::myOneOverOne
228 // ( 1, 1, 1, 0,
229 // &myZeroOverOne, &myOneOverZero, 0, 0,
230 // &myOneOverOne );
231 
232 // // Constant definitions in SternBrocot specializations.
233 // // DGtal::SternBrocot<BigInteger,int32_t>
234 // template<>
235 // DGtal::SternBrocot<BigInteger,int32_t>::Node
236 // DGtal::SternBrocot<BigInteger,int32_t>::myVirtualZeroOverOne
237 // ( 0, 1, 0, -2,
238 // 0, 0, 0, &myOneOverZero,
239 // &myOneOverZero );
240 
241 // template<>
242 // DGtal::SternBrocot<BigInteger,int32_t>::Node
243 // DGtal::SternBrocot<BigInteger,int32_t>::myOneOverZero
244 // ( 1, 0, 0, -1,
245 // // &myVirtualZeroOverOne, 0, &myOneOverOne, 0,
246 // &myZeroOverOne, 0, &myOneOverOne, 0,
247 // &myZeroOverOne );
248 
249 // template<>
250 // DGtal::SternBrocot<BigInteger,int32_t>::Node
251 // DGtal::SternBrocot<BigInteger,int32_t>::myZeroOverOne
252 // ( 0, 1, 0, 0,
253 // // &myVirtualZeroOverOne, &myOneOverZero,
254 // &myZeroOverOne, &myOneOverZero,
255 // 0, &myOneOverOne,
256 // &myOneOverZero );
257 
258 // template<>
259 // DGtal::SternBrocot<BigInteger,int32_t>::Node
260 // DGtal::SternBrocot<BigInteger,int32_t>::myOneOverOne
261 // ( 1, 1, 1, 0,
262 // &myZeroOverOne, &myOneOverZero, 0, 0,
263 // &myOneOverOne );
264 
265 // // Constant definitions in SternBrocot specializations.
266 // // DGtal::SternBrocot<BigInteger,BigInteger>
267 // template<>
268 // DGtal::SternBrocot<BigInteger,BigInteger>::Node
269 // DGtal::SternBrocot<BigInteger,BigInteger>::myVirtualZeroOverOne
270 // ( 0, 1, 0, -2,
271 // 0, 0, 0, &myOneOverZero,
272 // &myOneOverZero );
273 
274 // template<>
275 // DGtal::SternBrocot<BigInteger,BigInteger>::Node
276 // DGtal::SternBrocot<BigInteger,BigInteger>::myOneOverZero
277 // ( 1, 0, 0, -1,
278 // // &myVirtualZeroOverOne, 0, &myOneOverOne, 0,
279 // &myZeroOverOne, 0, &myOneOverOne, 0,
280 // &myZeroOverOne );
281 
282 // template<>
283 // DGtal::SternBrocot<BigInteger,BigInteger>::Node
284 // DGtal::SternBrocot<BigInteger,BigInteger>::myZeroOverOne
285 // ( 0, 1, 0, 0,
286 // // &myVirtualZeroOverOne, &myOneOverZero,
287 // &myZeroOverOne, &myOneOverZero,
288 // 0, &myOneOverOne,
289 // &myOneOverZero );
290 
291 // template<>
292 // DGtal::SternBrocot<BigInteger,BigInteger>::Node
293 // DGtal::SternBrocot<BigInteger,BigInteger>::myOneOverOne
294 // ( 1, 1, 1, 0,
295 // &myZeroOverOne, &myOneOverZero, 0, 0,
296 // &myOneOverOne );
297 
298 
299 
300 // // const DGtal::BigInteger SternBrocot<DGtal::BigInteger>::ONE = 1;
301 // // const DGtal::BigInteger SternBrocot<DGtal::BigInteger>::ZERO = 0;
302 // #endif
303 
304 }
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: The Stern-Brocot tree is the tree of irreducible fractions. This class allows to construct it pr...
Definition: SternBrocot.h:77