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