[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[2dd068] | 2 | |
---|
[e4fe2b] | 3 | #include "config.h" |
---|
[9d7aaa] | 4 | |
---|
[650f2d8] | 5 | #include "cf_assert.h" |
---|
[20040f] | 6 | |
---|
[2dd068] | 7 | #include "cf_defs.h" |
---|
| 8 | #include "int_cf.h" |
---|
| 9 | #include "canonicalform.h" |
---|
[ab0444] | 10 | #include "cf_factory.h" |
---|
[2dd068] | 11 | |
---|
[f23b9a] | 12 | //{{{ bool InternalCF::isOne, isZero () const |
---|
| 13 | // docu: see CanonicalForm::isOne(), CanonicalForm::isZero() |
---|
| 14 | bool |
---|
| 15 | InternalCF::isOne () const |
---|
| 16 | { |
---|
| 17 | return false; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | bool |
---|
| 21 | InternalCF::isZero () const |
---|
| 22 | { |
---|
| 23 | return false; |
---|
| 24 | } |
---|
| 25 | //}}} |
---|
| 26 | |
---|
[ab0444] | 27 | //{{{ CanonicalForm InternalCF::lc (), Lc (), LC () |
---|
| 28 | // docu: see CanonicalForm::lc(), Lc(), LC() |
---|
| 29 | CanonicalForm |
---|
| 30 | InternalCF::lc () |
---|
| 31 | { |
---|
| 32 | return CanonicalForm( copyObject() ); |
---|
| 33 | } |
---|
[2dd068] | 34 | |
---|
| 35 | CanonicalForm |
---|
[ab0444] | 36 | InternalCF::Lc () |
---|
[2dd068] | 37 | { |
---|
| 38 | return CanonicalForm( copyObject() ); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | CanonicalForm |
---|
[ab0444] | 42 | InternalCF::LC () |
---|
[2dd068] | 43 | { |
---|
| 44 | return CanonicalForm( copyObject() ); |
---|
| 45 | } |
---|
[ab0444] | 46 | //}}} |
---|
[2dd068] | 47 | |
---|
[ab0444] | 48 | //{{{ int InternalCF::degree () |
---|
| 49 | // docu: see CanonicalForm::degree() |
---|
[2dd068] | 50 | int |
---|
[ab0444] | 51 | InternalCF::degree () |
---|
[2dd068] | 52 | { |
---|
| 53 | if ( isZero() ) |
---|
[806c18] | 54 | return -1; |
---|
[2dd068] | 55 | else |
---|
[806c18] | 56 | return 0; |
---|
[2dd068] | 57 | } |
---|
[ab0444] | 58 | //}}} |
---|
[2dd068] | 59 | |
---|
[ab0444] | 60 | //{{{ CanonicalForm InternalCF::tailcoeff (), int InternalCF::taildegree () |
---|
| 61 | // docu: see CanonicalForm::tailcoeff(), taildegree() |
---|
[2dd068] | 62 | CanonicalForm |
---|
[ab0444] | 63 | InternalCF::tailcoeff () |
---|
[2dd068] | 64 | { |
---|
| 65 | return CanonicalForm( copyObject() ); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | int |
---|
[ab0444] | 69 | InternalCF::taildegree () |
---|
[2dd068] | 70 | { |
---|
[a1ec00e] | 71 | if ( isZero() ) |
---|
[806c18] | 72 | return -1; |
---|
[a1ec00e] | 73 | else |
---|
[806c18] | 74 | return 0; |
---|
[2dd068] | 75 | } |
---|
[ab0444] | 76 | //}}} |
---|
[2dd068] | 77 | |
---|
[24725be] | 78 | //{{{ InternalCF * InternalCF::num (), den () |
---|
[ab0444] | 79 | // docu: see CanonicalForm::num(), den() |
---|
[24725be] | 80 | InternalCF * |
---|
[ab0444] | 81 | InternalCF::num () |
---|
[2dd068] | 82 | { |
---|
[ab0444] | 83 | return copyObject(); |
---|
[2dd068] | 84 | } |
---|
| 85 | |
---|
[24725be] | 86 | InternalCF * |
---|
[ab0444] | 87 | InternalCF::den () |
---|
[2dd068] | 88 | { |
---|
[8710ff0] | 89 | return CFFactory::basic( 1L ); |
---|
[2dd068] | 90 | } |
---|
[ab0444] | 91 | //}}} |
---|
[2dd068] | 92 | |
---|
[24725be] | 93 | //{{{ InternalCF * InternalCF::sqrt () |
---|
[ab0444] | 94 | // docu: see CanonicalForm::sqrt() |
---|
[24725be] | 95 | InternalCF * |
---|
[ab0444] | 96 | InternalCF::sqrt () |
---|
[2dd068] | 97 | { |
---|
[a1ec00e] | 98 | ASSERT1( 0, "sqrt() not implemented for class %s", this->classname() ); |
---|
[2dd068] | 99 | return 0; |
---|
| 100 | } |
---|
[ab0444] | 101 | //}}} |
---|
[2dd068] | 102 | |
---|
[ab0444] | 103 | //{{{ int InternalCF::ilog2 () |
---|
| 104 | // docu: see CanonicalForm::ilog2() |
---|
| 105 | int |
---|
| 106 | InternalCF::ilog2 () |
---|
[2dd068] | 107 | { |
---|
[a1ec00e] | 108 | ASSERT1( 0, "ilog2() not implemented for class %s", this->classname() ); |
---|
[ab0444] | 109 | return 0; |
---|
[2dd068] | 110 | } |
---|
[ab0444] | 111 | //}}} |
---|
[2dd068] | 112 | |
---|
[a1ec00e] | 113 | //{{{ CanonicalForm InternalCF::coeff ( int i ) |
---|
| 114 | // docu: see CanonicalForm::operator []() |
---|
[ab0444] | 115 | CanonicalForm |
---|
[ea023f] | 116 | InternalCF::coeff ( int i ) |
---|
[2dd068] | 117 | { |
---|
[ab0444] | 118 | if ( i == 0 ) |
---|
[806c18] | 119 | return CanonicalForm( copyObject() ); |
---|
[ab0444] | 120 | else |
---|
[806c18] | 121 | return CanonicalForm( 0 ); |
---|
[2dd068] | 122 | } |
---|
[a1ec00e] | 123 | //}}} |
---|
[2dd068] | 124 | |
---|
[05d0b3] | 125 | //{{{ InternalCF * InternalCF::bgcdsame, bgcdcoeff ( const InternalCF * const ) |
---|
| 126 | // docu: see CanonicalForm::bgcd() |
---|
| 127 | InternalCF * |
---|
| 128 | InternalCF::bgcdsame ( const InternalCF * const ) const |
---|
| 129 | { |
---|
| 130 | ASSERT1( 0, "bgcd() not implemented for class %s", this->classname() ); |
---|
[8710ff0] | 131 | return CFFactory::basic( 0L ); |
---|
[05d0b3] | 132 | } |
---|
| 133 | |
---|
| 134 | InternalCF * |
---|
| 135 | InternalCF::bgcdcoeff ( const InternalCF * const ) |
---|
| 136 | { |
---|
| 137 | ASSERT1( 0, "bgcd() not implemented for class %s", this->classname() ); |
---|
[8710ff0] | 138 | return CFFactory::basic( 0L ); |
---|
[05d0b3] | 139 | } |
---|
| 140 | //}}} |
---|
| 141 | |
---|
| 142 | //{{{ InternalCF * InternalCF::bextgcdsame ( InternalCF *, CanonicalForm & a, CanonicalForm & b ) |
---|
| 143 | // docu: see CanonicalForm::bextgcd() |
---|
| 144 | InternalCF * |
---|
| 145 | InternalCF::bextgcdsame ( InternalCF *, CanonicalForm & a, CanonicalForm & b ) |
---|
| 146 | { |
---|
| 147 | ASSERT1( 0, "bextgcd() not implemented for class %s", this->classname() ); |
---|
| 148 | a = 0; b = 0; |
---|
[8710ff0] | 149 | return CFFactory::basic( 0L ); |
---|
[05d0b3] | 150 | } |
---|
| 151 | |
---|
| 152 | InternalCF * |
---|
| 153 | InternalCF::bextgcdcoeff ( InternalCF *, CanonicalForm & a, CanonicalForm & b ) |
---|
| 154 | { |
---|
| 155 | ASSERT1( 0, "bextgcd() not implemented for class %s", this->classname() ); |
---|
| 156 | a = 0; b = 0; |
---|
[8710ff0] | 157 | return CFFactory::basic( 0L ); |
---|
[05d0b3] | 158 | } |
---|
| 159 | //}}} |
---|
| 160 | |
---|
[8710ff0] | 161 | long |
---|
[ab0444] | 162 | InternalCF::intval() const |
---|
[2dd068] | 163 | { |
---|
[a1ec00e] | 164 | ASSERT1( 0, "intval() not implemented for class %s", this->classname() ); |
---|
[2dd068] | 165 | return 0; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | InternalCF* |
---|
[ab0444] | 169 | InternalCF::invert() |
---|
[2dd068] | 170 | { |
---|
[a1ec00e] | 171 | ASSERT1( 0, "invert() not implemented for class %s", this->classname() ); |
---|
[179ba9] | 172 | return 0; |
---|
| 173 | } |
---|
[e28e6d] | 174 | |
---|
| 175 | InternalCF* |
---|
[0349c20] | 176 | InternalCF::tryMulsame( InternalCF*, const CanonicalForm&) |
---|
[e28e6d] | 177 | { |
---|
| 178 | ASSERT1( 0, "tryMulsame() not implemented for class %s", this->classname() ); |
---|
| 179 | return 0; |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | InternalCF* |
---|
[0349c20] | 183 | InternalCF::tryInvert ( const CanonicalForm&, bool&) |
---|
[e28e6d] | 184 | { |
---|
| 185 | ASSERT1( 0, "tryInvert() not implemented for class %s", this->classname() ); |
---|
| 186 | return 0; |
---|
| 187 | } |
---|
| 188 | |
---|
| 189 | bool |
---|
[0349c20] | 190 | InternalCF::tryDivremsamet ( InternalCF*, InternalCF*&, InternalCF*&, const CanonicalForm&, bool&) |
---|
[e28e6d] | 191 | { |
---|
| 192 | ASSERT1( 0, "tryDivremsamet() not implemented for class %s", this->classname() ); |
---|
| 193 | return 0; |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | bool |
---|
[0349c20] | 197 | InternalCF::tryDivremcoefft ( InternalCF*, InternalCF*&, InternalCF*&, bool, const CanonicalForm&, bool&) |
---|
[e28e6d] | 198 | { |
---|
| 199 | ASSERT1( 0, "tryDivremcoefft() not implemented for class %s", this->classname() ); |
---|
| 200 | return 0; |
---|
| 201 | } |
---|
| 202 | |
---|
| 203 | InternalCF* |
---|
[0349c20] | 204 | InternalCF::tryDivsame ( InternalCF*, const CanonicalForm&, bool&) |
---|
[e28e6d] | 205 | { |
---|
| 206 | ASSERT1( 0, "tryDivsame() not implemented for class %s", this->classname() ); |
---|
| 207 | return 0; |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | InternalCF* |
---|
[0349c20] | 211 | InternalCF::tryDivcoeff ( InternalCF*, bool, const CanonicalForm&, bool&) |
---|
[e28e6d] | 212 | { |
---|
| 213 | ASSERT1( 0, "tryDivcoeff() not implemented for class %s", this->classname() ); |
---|
| 214 | return 0; |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | InternalCF* |
---|
[0349c20] | 218 | InternalCF::tryDividecoeff ( InternalCF*, bool, const CanonicalForm&, bool&) |
---|
[e28e6d] | 219 | { |
---|
| 220 | ASSERT1( 0, "tryDividecoeff() not implemented for class %s", this->classname() ); |
---|
| 221 | return 0; |
---|
| 222 | } |
---|