| 273 | } |
| 274 | |
| 275 | nforder *nforder::simplify() { |
| 276 | coeffs c = basecoeffs(); |
| 277 | if (!baseorder || !baseorder->baseorder) { |
| 278 | ref_count_incref(); |
| 279 | return this; |
| 280 | } |
| 281 | nforder * O = baseorder; |
| 282 | number den = n_Copy(divisor, c); |
| 283 | bigintmat *bas = getBasis(); |
| 284 | while (O->baseorder) { |
| 285 | bigintmat * b = bimMult(bas, O->viewBasis()); |
| 286 | n_InpMult(den, O->divisor, c); |
| 287 | O = O->baseorder; |
| 288 | delete bas; |
| 289 | bas = b; |
| 290 | } |
| 291 | nforder * res = new nforder(O, bas, den, c); |
| 292 | if (discriminant) |
| 293 | res->discriminant = n_Copy(discriminant, c); |
| 294 | |
| 295 | //TODO: copy multtable if we have it |
| 296 | delete bas; |
| 297 | n_Delete(&den, c); |
| 298 | return res; |
| 299 | } |
| 300 | |
| 301 | void nforder::elAdd(bigintmat *a, bigintmat *b) { |
| 302 | if ((a->cols() != 1) || (a->rows() != dimension) || (b->cols() != 1) || (b->rows() != dimension)) { |