3 * Implementation of several small and furry utilities needed within GiNaC
4 * but not of any interest to the user of the library. */
7 * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef NO_NAMESPACE_GINAC
31 #endif // ndef NO_NAMESPACE_GINAC
33 /* Version information buried into the library */
34 const int version_major = GINACLIB_MAJOR_VERSION;
35 const int version_minor = GINACLIB_MINOR_VERSION;
36 const int version_micro = GINACLIB_MICRO_VERSION;
39 /** ctor for pole_error exception class. */
40 pole_error::pole_error(const std::string& what_arg, int degree)
41 : domain_error(what_arg)
46 /** Return the degree of the pole_error exception class. */
47 int pole_error::degree(void) const
52 // some compilers (e.g. cygwin) define a macro log2, causing confusion
54 /** Integer binary logarithm */
55 unsigned log2(unsigned n)
58 for (k = 0; n > 1; n >>= 1) ++k;
63 /** Compare two pointers (just to establish some sort of canonical order).
64 * @return -1, 0, or 1 */
65 int compare_pointers(const void * a, const void * b)
76 // `construct on first use' chest of numbers
80 const numeric & _num_120(void)
82 const static ex e = ex(numeric(-120));
83 const static numeric * n = static_cast<const numeric *>(e.bp);
87 const ex & _ex_120(void)
89 static ex * e = new ex(_num_120());
94 const numeric & _num_60(void)
96 const static ex e = ex(numeric(-60));
97 const static numeric * n = static_cast<const numeric *>(e.bp);
101 const ex & _ex_60(void)
103 static ex * e = new ex(_num_60());
108 const numeric & _num_48(void)
110 const static ex e = ex(numeric(-48));
111 const static numeric * n = static_cast<const numeric *>(e.bp);
115 const ex & _ex_48(void)
117 static ex * e = new ex(_num_48());
122 const numeric & _num_30(void)
124 const static ex e = ex(numeric(-30));
125 const static numeric * n = static_cast<const numeric *>(e.bp);
129 const ex & _ex_30(void)
131 static ex * e = new ex(_num_30());
136 const numeric & _num_25(void)
138 const static ex e = ex(numeric(-25));
139 const static numeric * n = static_cast<const numeric *>(e.bp);
143 const ex & _ex_25(void)
145 static ex * e = new ex(_num_25());
150 const numeric & _num_24(void)
152 const static ex e = ex(numeric(-24));
153 const static numeric * n = static_cast<const numeric *>(e.bp);
157 const ex & _ex_24(void)
159 static ex * e = new ex(_num_24());
164 const numeric & _num_20(void)
166 const static ex e = ex(numeric(-20));
167 const static numeric * n = static_cast<const numeric *>(e.bp);
171 const ex & _ex_20(void)
173 static ex * e = new ex(_num_20());
178 const numeric & _num_18(void)
180 const static ex e = ex(numeric(-18));
181 const static numeric * n = static_cast<const numeric *>(e.bp);
185 const ex & _ex_18(void)
187 static ex * e = new ex(_num_18());
192 const numeric & _num_15(void)
194 const static ex e = ex(numeric(-15));
195 const static numeric * n = static_cast<const numeric *>(e.bp);
199 const ex & _ex_15(void)
201 static ex * e = new ex(_num_15());
206 const numeric & _num_12(void)
208 const static ex e = ex(numeric(-12));
209 const static numeric * n = static_cast<const numeric *>(e.bp);
213 const ex & _ex_12(void)
215 static ex * e = new ex(_num_12());
220 const numeric & _num_11(void)
222 const static ex e = ex(numeric(-11));
223 const static numeric * n = static_cast<const numeric *>(e.bp);
227 const ex & _ex_11(void)
229 static ex * e = new ex(_num_11());
234 const numeric & _num_10(void)
236 const static ex e = ex(numeric(-10));
237 const static numeric * n = static_cast<const numeric *>(e.bp);
241 const ex & _ex_10(void)
243 static ex * e = new ex(_num_10());
248 const numeric & _num_9(void)
250 const static ex e = ex(numeric(-9));
251 const static numeric * n = static_cast<const numeric *>(e.bp);
255 const ex & _ex_9(void)
257 static ex * e = new ex(_num_9());
262 const numeric & _num_8(void)
264 const static ex e = ex(numeric(-8));
265 const static numeric * n = static_cast<const numeric *>(e.bp);
269 const ex & _ex_8(void)
271 static ex * e = new ex(_num_8());
276 const numeric & _num_7(void)
278 const static ex e = ex(numeric(-7));
279 const static numeric * n = static_cast<const numeric *>(e.bp);
283 const ex & _ex_7(void)
285 static ex * e = new ex(_num_7());
290 const numeric & _num_6(void)
292 const static ex e = ex(numeric(-6));
293 const static numeric * n = static_cast<const numeric *>(e.bp);
297 const ex & _ex_6(void)
299 static ex * e = new ex(_num_6());
304 const numeric & _num_5(void)
306 const static ex e = ex(numeric(-5));
307 const static numeric * n = static_cast<const numeric *>(e.bp);
311 const ex & _ex_5(void)
313 static ex * e = new ex(_num_5());
318 const numeric & _num_4(void)
320 const static ex e = ex(numeric(-4));
321 const static numeric * n = static_cast<const numeric *>(e.bp);
325 const ex & _ex_4(void)
327 static ex * e = new ex(_num_4());
332 const numeric & _num_3(void)
334 const static ex e = ex(numeric(-3));
335 const static numeric * n = static_cast<const numeric *>(e.bp);
339 const ex & _ex_3(void)
341 static ex * e = new ex(_num_3());
346 const numeric & _num_2(void)
348 const static ex e = ex(numeric(-2));
349 const static numeric * n = static_cast<const numeric *>(e.bp);
353 const ex & _ex_2(void)
355 static ex * e = new ex(_num_2());
360 const numeric & _num_1(void)
362 const static ex e = ex(numeric(-1));
363 const static numeric * n = static_cast<const numeric *>(e.bp);
367 const ex & _ex_1(void)
369 static ex * e = new ex(_num_1());
374 const numeric & _num_1_2(void)
376 const static ex e = ex(numeric(-1,2));
377 const static numeric * n = static_cast<const numeric *>(e.bp);
381 const ex & _ex_1_2(void)
383 static ex * e = new ex(_num_1_2());
388 const numeric & _num_1_3(void)
390 const static ex e = ex(numeric(-1,3));
391 const static numeric * n = static_cast<const numeric *>(e.bp);
395 const ex & _ex_1_3(void)
397 static ex * e = new ex(_num_1_3());
402 const numeric & _num_1_4(void)
404 const static ex e = ex(numeric(-1,4));
405 const static numeric * n = static_cast<const numeric *>(e.bp);
409 const ex & _ex_1_4(void)
411 static ex * e = new ex(_num_1_4());
416 const numeric & _num0(void)
418 const static ex e = ex(numeric(0));
419 const static numeric * n = static_cast<const numeric *>(e.bp);
423 const ex & _ex0(void)
425 static ex * e = new ex(_num0());
430 const numeric & _num1_4(void)
432 const static ex e = ex(numeric(1,4));
433 const static numeric * n = static_cast<const numeric *>(e.bp);
437 const ex & _ex1_4(void)
439 static ex * e = new ex(_num1_4());
444 const numeric & _num1_3(void)
446 const static ex e = ex(numeric(1,3));
447 const static numeric * n = static_cast<const numeric *>(e.bp);
451 const ex & _ex1_3(void)
453 static ex * e = new ex(_num1_3());
458 const numeric & _num1_2(void)
460 const static ex e = ex(numeric(1,2));
461 const static numeric * n = static_cast<const numeric *>(e.bp);
465 const ex & _ex1_2(void)
467 static ex * e = new ex(_num1_2());
472 const numeric & _num1(void)
474 const static ex e = ex(numeric(1));
475 const static numeric * n = static_cast<const numeric *>(e.bp);
479 const ex & _ex1(void)
481 static ex * e = new ex(_num1());
486 const numeric & _num2(void)
488 const static ex e = ex(numeric(2));
489 const static numeric * n = static_cast<const numeric *>(e.bp);
493 const ex & _ex2(void)
495 static ex * e = new ex(_num2());
500 const numeric & _num3(void)
502 const static ex e = ex(numeric(3));
503 const static numeric * n = static_cast<const numeric *>(e.bp);
507 const ex & _ex3(void)
509 static ex * e = new ex(_num3());
514 const numeric & _num4(void)
516 const static ex e = ex(numeric(4));
517 const static numeric * n = static_cast<const numeric *>(e.bp);
521 const ex & _ex4(void)
523 static ex * e = new ex(_num4());
528 const numeric & _num5(void)
530 const static ex e = ex(numeric(5));
531 const static numeric * n = static_cast<const numeric *>(e.bp);
535 const ex & _ex5(void)
537 static ex * e = new ex(_num5());
542 const numeric & _num6(void)
544 const static ex e = ex(numeric(6));
545 const static numeric * n = static_cast<const numeric *>(e.bp);
549 const ex & _ex6(void)
551 static ex * e = new ex(_num6());
556 const numeric & _num7(void)
558 const static ex e = ex(numeric(7));
559 const static numeric * n = static_cast<const numeric *>(e.bp);
563 const ex & _ex7(void)
565 static ex * e = new ex(_num7());
570 const numeric & _num8(void)
572 const static ex e = ex(numeric(8));
573 const static numeric * n = static_cast<const numeric *>(e.bp);
577 const ex & _ex8(void)
579 static ex * e = new ex(_num8());
584 const numeric & _num9(void)
586 const static ex e = ex(numeric(9));
587 const static numeric * n = static_cast<const numeric *>(e.bp);
591 const ex & _ex9(void)
593 static ex * e = new ex(_num9());
598 const numeric & _num10(void)
600 const static ex e = ex(numeric(10));
601 const static numeric * n = static_cast<const numeric *>(e.bp);
605 const ex & _ex10(void)
607 static ex * e = new ex(_num10());
612 const numeric & _num11(void)
614 const static ex e = ex(numeric(11));
615 const static numeric * n = static_cast<const numeric *>(e.bp);
619 const ex & _ex11(void)
621 static ex * e = new ex(_num11());
626 const numeric & _num12(void)
628 const static ex e = ex(numeric(12));
629 const static numeric * n = static_cast<const numeric *>(e.bp);
633 const ex & _ex12(void)
635 static ex * e = new ex(_num12());
640 const numeric & _num15(void)
642 const static ex e = ex(numeric(15));
643 const static numeric * n = static_cast<const numeric *>(e.bp);
647 const ex & _ex15(void)
649 static ex * e = new ex(_num15());
654 const numeric & _num18(void)
656 const static ex e = ex(numeric(18));
657 const static numeric * n = static_cast<const numeric *>(e.bp);
661 const ex & _ex18(void)
663 static ex * e = new ex(_num18());
668 const numeric & _num20(void)
670 const static ex e = ex(numeric(20));
671 const static numeric * n = static_cast<const numeric *>(e.bp);
675 const ex & _ex20(void)
677 static ex * e = new ex(_num20());
682 const numeric & _num24(void)
684 const static ex e = ex(numeric(24));
685 const static numeric * n = static_cast<const numeric *>(e.bp);
689 const ex & _ex24(void)
691 static ex * e = new ex(_num24());
696 const numeric & _num25(void)
698 const static ex e = ex(numeric(25));
699 const static numeric * n = static_cast<const numeric *>(e.bp);
703 const ex & _ex25(void)
705 static ex * e = new ex(_num25());
710 const numeric & _num30(void)
712 const static ex e = ex(numeric(30));
713 const static numeric * n = static_cast<const numeric *>(e.bp);
717 const ex & _ex30(void)
719 static ex * e = new ex(_num30());
724 const numeric & _num48(void)
726 const static ex e = ex(numeric(48));
727 const static numeric * n = static_cast<const numeric *>(e.bp);
731 const ex & _ex48(void)
733 static ex * e = new ex(_num48());
738 const numeric & _num60(void)
740 const static ex e = ex(numeric(60));
741 const static numeric * n = static_cast<const numeric *>(e.bp);
745 const ex & _ex60(void)
747 static ex * e = new ex(_num60());
752 const numeric & _num120(void)
754 const static ex e = ex(numeric(120));
755 const static numeric * n = static_cast<const numeric *>(e.bp);
759 const ex & _ex120(void)
761 static ex * e = new ex(_num120());
765 // comment skeleton for header files
770 // default constructor, destructor, copy constructor assignment operator and helpers
773 // other constructors
776 // functions overriding virtual functions from bases classes
779 // new virtual functions which can be overridden by derived classes
782 // non-virtual functions in this class
790 // comment skeleton for implementation files
794 // default constructor, destructor, copy constructor assignment operator and helpers
801 // other constructors
808 // functions overriding virtual functions from bases classes
816 // new virtual functions which can be overridden by derived classes
824 // non-virtual functions in this class
832 // static member variables
840 #ifndef NO_NAMESPACE_GINAC
842 #endif // ndef NO_NAMESPACE_GINAC