My Project
Loading...
Searching...
No Matches
bigintmat.h File Reference
#include "coeffs/coeffs.h"

Go to the source code of this file.

Data Structures

class  bigintmat
 Matrices of numbers. More...
 

Macros

#define BIMATELEM(M, I, J)
 

Functions

bool operator== (const bigintmat &lhr, const bigintmat &rhr)
 
bool operator!= (const bigintmat &lhr, const bigintmat &rhr)
 
bigintmatbimAdd (bigintmat *a, bigintmat *b)
 Matrix-Add/-Sub/-Mult so oder mit operator+/-/* ? @Note: NULL as a result means an error (non-compatible matrices?)
 
bigintmatbimAdd (bigintmat *a, long b)
 
bigintmatbimSub (bigintmat *a, bigintmat *b)
 
bigintmatbimSub (bigintmat *a, long b)
 
bigintmatbimMult (bigintmat *a, bigintmat *b)
 
bigintmatbimMult (bigintmat *a, long b)
 
bigintmatbimMult (bigintmat *a, number b, const coeffs cf)
 
bigintmatbimCopy (const bigintmat *b)
 same as copy constructor - apart from it being able to accept NULL as input
 
intvecbim2iv (bigintmat *b)
 
bigintmativ2bim (intvec *b, const coeffs C)
 
bigintmatbimChangeCoeff (bigintmat *a, coeffs cnew)
 Liefert Kopier von Matrix a zurück, mit coeffs cnew statt den ursprünglichen.
 
void bimMult (bigintmat *a, bigintmat *b, bigintmat *c)
 Multipliziert Matrix a und b und speichert Ergebnis in c.
 
number solveAx (bigintmat *A, bigintmat *b, bigintmat *x)
 solve Ax=b*d. x needs to be pre-allocated to the same number of columns as b. the minimal denominator d is returned. Currently available for Z, Q and Z/nZ (and possibly for all fields: d=1 there) Beware that the internal functions can find the kernel as well - but the interface is lacking.
 
int kernbase (bigintmat *a, bigintmat *c, number p, coeffs q)
 a basis for the nullspace of a mod p: only used internally in Round2. Don't use it.
 
bool nCoeffs_are_equal (coeffs r, coeffs s)
 
void diagonalForm (bigintmat *a, bigintmat **b, bigintmat **c)
 

Macro Definition Documentation

◆ BIMATELEM

#define BIMATELEM ( M,
I,
J )
Value:
(M)[(I-1)*(M).cols()+J-1]
#define M
Definition sirandom.c:25

Definition at line 133 of file bigintmat.h.

Function Documentation

◆ bim2iv()

intvec * bim2iv ( bigintmat * b)

Definition at line 339 of file bigintmat.cc.

340{
341 intvec * iv = new intvec(b->rows(), b->cols(), 0);
342 for (int i=0; i<(b->rows())*(b->cols()); i++)
343 (*iv)[i] = n_Int((*b)[i], b->basecoeffs()); // Geht das so?
344 return iv;
345}
int i
Definition cfEzgcd.cc:132
CanonicalForm b
Definition cfModGcd.cc:4111
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition coeffs.h:548

◆ bimAdd() [1/2]

bigintmat * bimAdd ( bigintmat * a,
bigintmat * b )

Matrix-Add/-Sub/-Mult so oder mit operator+/-/* ? @Note: NULL as a result means an error (non-compatible matrices?)

Definition at line 180 of file bigintmat.cc.

181{
182 if (a->cols() != b->cols()) return NULL;
183 if (a->rows() != b->rows()) return NULL;
184 if (a->basecoeffs() != b->basecoeffs()) { return NULL; }
185
186 const coeffs basecoeffs = a->basecoeffs();
187
188 int i;
189
190 bigintmat * bim = new bigintmat(a->rows(), a->cols(), basecoeffs);
191
192 for (i=a->rows()*a->cols()-1;i>=0; i--)
193 bim->rawset(i, n_Add((*a)[i], (*b)[i], basecoeffs), basecoeffs);
194
195 return bim;
196}
Matrices of numbers.
Definition bigintmat.h:51
int cols() const
Definition bigintmat.h:144
int rows() const
Definition bigintmat.h:145
void rawset(int i, number n, const coeffs C=NULL)
replace an entry with the given number n (only delete old). NOTE: starts at [0]. Should be named set_...
Definition bigintmat.h:196
coeffs basecoeffs() const
Definition bigintmat.h:146
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
Definition coeffs.h:651
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition omList.c:12

◆ bimAdd() [2/2]

bigintmat * bimAdd ( bigintmat * a,
long b )

Definition at line 197 of file bigintmat.cc.

198{
199
200 const int mn = si_min(a->rows(),a->cols());
201
202 const coeffs basecoeffs = a->basecoeffs();
203 number bb=n_Init(b,basecoeffs);
204
205 int i;
206
207 bigintmat * bim = new bigintmat(a->rows(),a->cols() , basecoeffs);
208
209 for (i=1; i<=mn; i++)
210 BIMATELEM(*bim,i,i)=n_Add(BIMATELEM(*a,i,i), bb, basecoeffs);
211
212 n_Delete(&bb,basecoeffs);
213 return bim;
214}
static int si_min(const int a, const int b)
Definition auxiliary.h:126
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:459
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:539

◆ bimChangeCoeff()

bigintmat * bimChangeCoeff ( bigintmat * a,
coeffs cnew )

Liefert Kopier von Matrix a zurück, mit coeffs cnew statt den ursprünglichen.

Definition at line 1797 of file bigintmat.cc.

1798{
1799 coeffs cold = a->basecoeffs();
1800 bigintmat *b = new bigintmat(a->rows(), a->cols(), cnew);
1801 // Erzeugt Karte von alten coeffs nach neuen
1802 nMapFunc f = n_SetMap(cold, cnew);
1803 number t1;
1804 number t2;
1805 // apply map to all entries.
1806 for (int i=1; i<=a->rows(); i++)
1807 {
1808 for (int j=1; j<=a->cols(); j++)
1809 {
1810 t1 = a->get(i, j);
1811 t2 = f(t1, cold, cnew);
1812 b->set(i, j, t2);
1813 n_Delete(&t1, cold);
1814 n_Delete(&t2, cnew);
1815 }
1816 }
1817 return b;
1818}
FILE * f
Definition checklibs.c:9
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
Definition bigintmat.cc:117
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:701
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
int j
Definition facHensel.cc:110

◆ bimCopy()

bigintmat * bimCopy ( const bigintmat * b)

same as copy constructor - apart from it being able to accept NULL as input

Definition at line 403 of file bigintmat.cc.

404{
405 if (b == NULL)
406 return NULL;
407
408 return new bigintmat(b);
409}

◆ bimMult() [1/4]

bigintmat * bimMult ( bigintmat * a,
bigintmat * b )

Definition at line 253 of file bigintmat.cc.

254{
255 const int ca = a->cols();
256 const int cb = b->cols();
257
258 const int ra = a->rows();
259 const int rb = b->rows();
260
261 if (ca != rb)
262 {
263#ifndef SING_NDEBUG
264 Werror("wrong bigintmat sizes at multiplication a * b: acols: %d != brows: %d\n", ca, rb);
265#endif
266 return NULL;
267 }
268
269 assume (ca == rb);
270
271 if (a->basecoeffs() != b->basecoeffs()) { return NULL; }
272
273 const coeffs basecoeffs = a->basecoeffs();
274
275 int i, j, k;
276
277 number sum;
278
279 bigintmat * bim = new bigintmat(ra, cb, basecoeffs);
280
281 for (i=1; i<=ra; i++)
282 for (j=1; j<=cb; j++)
283 {
284 sum = n_Init(0, basecoeffs);
285
286 for (k=1; k<=ca; k++)
287 {
288 number prod = n_Mult( BIMATELEM(*a, i, k), BIMATELEM(*b, k, j), basecoeffs);
289
290 n_InpAdd(sum, prod, basecoeffs);
291
292 n_Delete(&prod, basecoeffs);
293 }
294 bim->rawset(i, j, sum, basecoeffs);
295 }
296 return bim;
297}
int k
Definition cfEzgcd.cc:99
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition coeffs.h:637
static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
addition of 'a' and 'b'; replacement of 'a' by the sum a+b
Definition coeffs.h:647
fq_nmod_poly_t prod
Definition facHensel.cc:100
#define assume(x)
Definition mod2.h:389
void Werror(const char *fmt,...)
Definition reporter.cc:189

◆ bimMult() [2/4]

void bimMult ( bigintmat * a,
bigintmat * b,
bigintmat * c )

Multipliziert Matrix a und b und speichert Ergebnis in c.

Definition at line 1922 of file bigintmat.cc.

1923{
1924 if (!nCoeffs_are_equal(a->basecoeffs(), b->basecoeffs()))
1925 {
1926 WerrorS("Error in bimMult. Coeffs do not agree!");
1927 return;
1928 }
1929 if ((a->rows() != c->rows()) || (b->cols() != c->cols()) || (a->cols() != b->rows()))
1930 {
1931 WerrorS("Error in bimMult. Dimensions do not agree!");
1932 return;
1933 }
1934 bigintmat *tmp = bimMult(a, b);
1935 c->copy(tmp);
1936
1937 delete tmp;
1938}
bool nCoeffs_are_equal(coeffs r, coeffs s)
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition bigintmat.cc:253
bool copy(bigintmat *b)
Kopiert Einträge von b auf Bigintmat.
void WerrorS(const char *s)
Definition feFopen.cc:24

◆ bimMult() [3/4]

bigintmat * bimMult ( bigintmat * a,
long b )

Definition at line 299 of file bigintmat.cc.

300{
301
302 const int mn = a->rows()*a->cols();
303
304 const coeffs basecoeffs = a->basecoeffs();
305 number bb=n_Init(b,basecoeffs);
306
307 int i;
308
309 bigintmat * bim = new bigintmat(a->rows(),a->cols() , basecoeffs);
310
311 for (i=0; i<mn; i++)
312 bim->rawset(i, n_Mult((*a)[i], bb, basecoeffs), basecoeffs);
313
314 n_Delete(&bb,basecoeffs);
315 return bim;
316}

◆ bimMult() [4/4]

bigintmat * bimMult ( bigintmat * a,
number b,
const coeffs cf )

Definition at line 318 of file bigintmat.cc.

319{
320 if (cf!=a->basecoeffs()) return NULL;
321
322 const int mn = a->rows()*a->cols();
323
324 const coeffs basecoeffs = a->basecoeffs();
325
326 int i;
327
328 bigintmat * bim = new bigintmat(a->rows(),a->cols() , basecoeffs);
329
330 for (i=0; i<mn; i++)
331 bim->rawset(i, n_Mult((*a)[i], b, basecoeffs), basecoeffs);
332
333 return bim;
334}
CanonicalForm cf
Definition cfModGcd.cc:4091

◆ bimSub() [1/2]

bigintmat * bimSub ( bigintmat * a,
bigintmat * b )

Definition at line 216 of file bigintmat.cc.

217{
218 if (a->cols() != b->cols()) return NULL;
219 if (a->rows() != b->rows()) return NULL;
220 if (a->basecoeffs() != b->basecoeffs()) { return NULL; }
221
222 const coeffs basecoeffs = a->basecoeffs();
223
224 int i;
225
226 bigintmat * bim = new bigintmat(a->rows(), a->cols(), basecoeffs);
227
228 for (i=a->rows()*a->cols()-1;i>=0; i--)
229 bim->rawset(i, n_Sub((*a)[i], (*b)[i], basecoeffs), basecoeffs);
230
231 return bim;
232}
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition coeffs.h:656

◆ bimSub() [2/2]

bigintmat * bimSub ( bigintmat * a,
long b )

Definition at line 234 of file bigintmat.cc.

235{
236 const int mn = si_min(a->rows(),a->cols());
237
238 const coeffs basecoeffs = a->basecoeffs();
239 number bb=n_Init(b,basecoeffs);
240
241 int i;
242
243 bigintmat * bim = new bigintmat(a->rows(),a->cols() , basecoeffs);
244
245 for (i=1; i<=mn; i++)
246 BIMATELEM(*bim,i,i)=n_Sub(BIMATELEM(*a,i,i), bb, basecoeffs);
247
248 n_Delete(&bb,basecoeffs);
249 return bim;
250}

◆ diagonalForm()

void diagonalForm ( bigintmat * a,
bigintmat ** b,
bigintmat ** c )

Definition at line 2461 of file bigintmat.cc.

2462{
2463 bigintmat * t, *s, *a=A;
2464 coeffs R = a->basecoeffs();
2465 if (T)
2466 {
2467 *T = new bigintmat(a->cols(), a->cols(), R),
2468 (*T)->one();
2469 t = new bigintmat(*T);
2470 }
2471 else
2472 {
2473 t = *T;
2474 }
2475
2476 if (S)
2477 {
2478 *S = new bigintmat(a->rows(), a->rows(), R);
2479 (*S)->one();
2480 s = new bigintmat(*S);
2481 }
2482 else
2483 {
2484 s = *S;
2485 }
2486
2487 int flip=0;
2488 do
2489 {
2490 bigintmat * x, *X;
2491 if (flip)
2492 {
2493 x = s;
2494 X = *S;
2495 }
2496 else
2497 {
2498 x = t;
2499 X = *T;
2500 }
2501
2502 if (x)
2503 {
2504 x->one();
2505 bigintmat * r = new bigintmat(a->rows()+a->cols(), a->cols(), R);
2506 bigintmat * rw = new bigintmat(1, a->cols(), R);
2507 for(int i=0; i<a->cols(); i++)
2508 {
2509 x->getrow(i+1, rw);
2510 r->setrow(i+1, rw);
2511 }
2512 for (int i=0; i<a->rows(); i++)
2513 {
2514 a->getrow(i+1, rw);
2515 r->setrow(i+a->cols()+1, rw);
2516 }
2517 r->hnf();
2518 for(int i=0; i<a->cols(); i++)
2519 {
2520 r->getrow(i+1, rw);
2521 x->setrow(i+1, rw);
2522 }
2523 for(int i=0; i<a->rows(); i++)
2524 {
2525 r->getrow(i+a->cols()+1, rw);
2526 a->setrow(i+1, rw);
2527 }
2528 delete rw;
2529 delete r;
2530
2531#if 0
2532 Print("X: %ld\n", X);
2533 X->Print();
2534 Print("\nx: %ld\n", x);
2535 x->Print();
2536#endif
2537 bimMult(X, x, X);
2538#if 0
2539 Print("\n2:X: %ld %ld %ld\n", X, *S, *T);
2540 X->Print();
2541 Print("\n2:x: %ld\n", x);
2542 x->Print();
2543 PrintLn();
2544#endif
2545 }
2546 else
2547 {
2548 a->hnf();
2549 }
2550
2551 int diag = 1;
2552 for(int i=a->rows(); diag && i>0; i--)
2553 {
2554 for(int j=a->cols(); j>0; j--)
2555 {
2556 if ((a->rows()-i)!=(a->cols()-j) && !n_IsZero(a->view(i, j), R))
2557 {
2558 diag = 0;
2559 break;
2560 }
2561 }
2562 }
2563#if 0
2564 PrintS("Diag ? %d\n", diag);
2565 a->Print();
2566 PrintLn();
2567#endif
2568 if (diag) break;
2569
2570 a = a->transpose(); // leaks - I need to write inpTranspose
2571 flip = 1-flip;
2572 } while (1);
2573 if (flip)
2574 a = a->transpose();
2575
2576 if (S) *S = (*S)->transpose();
2577 if (s) delete s;
2578 if (t) delete t;
2579 A->copy(a);
2580}
Variable x
Definition cfModGcd.cc:4090
void Print()
IO: simply prints the matrix to the current output (screen?)
Definition bigintmat.cc:437
void hnf()
transforms INPLACE to HNF
bigintmat * transpose()
Definition bigintmat.cc:35
void setrow(int i, bigintmat *m)
Setzt i-te Zeile gleich übergebenem Vektor (Matrix) m.
Definition bigintmat.cc:855
number view(int i, int j) const
view an entry an entry. NOTE: starts at [1,1]
Definition bigintmat.cc:125
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
void getrow(int i, bigintmat *a)
Schreibt i-te Zeile in Vektor (Matrix) a.
Definition bigintmat.cc:786
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:468
#define Print
Definition emacs.cc:80
const CanonicalForm int s
Definition facAbsFact.cc:51
std::pair< ideal, ring > flip(const ideal I, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal, const gfan::ZVector adjustedInteriorPoint, const gfan::ZVector adjustedFacetNormal)
Definition flip.cc:17
STATIC_VAR jList * T
Definition janet.cc:30
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
#define R
Definition sirandom.c:27
#define A
Definition sirandom.c:24

◆ iv2bim()

bigintmat * iv2bim ( intvec * b,
const coeffs C )

Definition at line 347 of file bigintmat.cc.

348{
349 const int l = (b->rows())*(b->cols());
350 bigintmat * bim = new bigintmat(b->rows(), b->cols(), C);
351
352 for (int i=0; i < l; i++)
353 bim->rawset(i, n_Init((*b)[i], C), C);
354
355 return bim;
356}
int l
Definition cfEzgcd.cc:100

◆ kernbase()

int kernbase ( bigintmat * a,
bigintmat * c,
number p,
coeffs q )

a basis for the nullspace of a mod p: only used internally in Round2. Don't use it.

Definition at line 2585 of file bigintmat.cc.

2586{
2587#if 0
2588 PrintS("Kernel of ");
2589 a->Print();
2590 PrintS(" modulo ");
2591 n_Print(p, q);
2592 PrintLn();
2593#endif
2594
2595 coeffs coe = numbercoeffs(p, q);
2596 bigintmat *m = bimChangeCoeff(a, coe), *U, *V;
2597 diagonalForm(m, &U, &V);
2598#if 0
2599 PrintS("\ndiag form: ");
2600 m->Print();
2601 PrintS("\nU:\n");
2602 U->Print();
2603 PrintS("\nV:\n");
2604 V->Print();
2605 PrintLn();
2606#endif
2607
2608 int rg = 0;
2609#undef MIN
2610#define MIN(a,b) (a < b ? a : b)
2611 for(rg=0; rg<MIN(m->rows(), m->cols()) && !n_IsZero(m->view(m->rows()-rg,m->cols()-rg), coe); rg++);
2612
2613 bigintmat * k = new bigintmat(m->cols(), m->rows(), coe);
2614 for(int i=0; i<rg; i++)
2615 {
2616 number A = n_Ann(m->view(m->rows()-i, m->cols()-i), coe);
2617 k->set(m->cols()-i, i+1, A);
2618 n_Delete(&A, coe);
2619 }
2620 for(int i=rg; i<m->cols(); i++)
2621 {
2622 k->set(m->cols()-i, i+1-rg, n_Init(1, coe));
2623 }
2624 bimMult(V, k, k);
2625 c->copy(bimChangeCoeff(k, q));
2626 return c->cols();
2627}
bigintmat * bimChangeCoeff(bigintmat *a, coeffs cnew)
Liefert Kopier von Matrix a zurück, mit coeffs cnew statt den ursprünglichen.
#define MIN(a, b)
void diagonalForm(bigintmat *A, bigintmat **S, bigintmat **T)
static coeffs numbercoeffs(number n, coeffs c)
create Z/nA of type n_Zn
Definition bigintmat.cc:20
int m
Definition cfEzgcd.cc:128
int p
Definition cfModGcd.cc:4086
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL
Definition coeffs.h:680
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
Definition numbers.cc:655

◆ nCoeffs_are_equal()

bool nCoeffs_are_equal ( coeffs r,
coeffs s )

Definition at line 2629 of file bigintmat.cc.

2630{
2631 if ((r == NULL) || (s == NULL))
2632 return false;
2633 if (r == s)
2634 return true;
2635 if ((getCoeffType(r)==n_Z) && (getCoeffType(s)==n_Z))
2636 return true;
2637 if ((getCoeffType(r)==n_Zp) && (getCoeffType(s)==n_Zp))
2638 {
2639 if (r->ch == s->ch)
2640 return true;
2641 else
2642 return false;
2643 }
2644 // n_Zn stimmt wahrscheinlich noch nicht
2645 if ((getCoeffType(r)==n_Zn) && (getCoeffType(s)==n_Zn))
2646 {
2647 if (r->ch == s->ch)
2648 return true;
2649 else
2650 return false;
2651 }
2652 if ((getCoeffType(r)==n_Q) && (getCoeffType(s)==n_Q))
2653 return true;
2654 // FALL n_Zn FEHLT NOCH!
2655 //if ((getCoeffType(r)==n_Zn) && (getCoeffType(s)==n_Zn))
2656 return false;
2657}
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
@ n_Zn
only used if HAVE_RINGS is defined
Definition coeffs.h:44
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
@ n_Z
only used if HAVE_RINGS is defined
Definition coeffs.h:43
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:429

◆ operator!=()

bool operator!= ( const bigintmat & lhr,
const bigintmat & rhr )

Definition at line 174 of file bigintmat.cc.

175{
176 return !(lhr==rhr);
177}

◆ operator==()

bool operator== ( const bigintmat & lhr,
const bigintmat & rhr )

Definition at line 157 of file bigintmat.cc.

158{
159 if (&lhr == &rhr) { return true; }
160 if (lhr.cols() != rhr.cols()) { return false; }
161 if (lhr.rows() != rhr.rows()) { return false; }
162 if (lhr.basecoeffs() != rhr.basecoeffs()) { return false; }
163
164 const int l = (lhr.rows())*(lhr.cols());
165
166 for (int i=0; i < l; i++)
167 {
168 if (!n_Equal(lhr[i], rhr[i], lhr.basecoeffs())) { return false; }
169 }
170
171 return true;
172}
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition coeffs.h:464

◆ solveAx()

number solveAx ( bigintmat * A,
bigintmat * b,
bigintmat * x )

solve Ax=b*d. x needs to be pre-allocated to the same number of columns as b. the minimal denominator d is returned. Currently available for Z, Q and Z/nZ (and possibly for all fields: d=1 there) Beware that the internal functions can find the kernel as well - but the interface is lacking.

Definition at line 2418 of file bigintmat.cc.

2419{
2420#if 0
2421 PrintS("Solve Ax=b for A=\n");
2422 A->Print();
2423 PrintS("\nb = \n");
2424 b->Print();
2425 PrintS("\nx = \n");
2426 x->Print();
2427 PrintLn();
2428#endif
2429
2430 coeffs R = A->basecoeffs();
2431 assume (R == b->basecoeffs());
2432 assume (R == x->basecoeffs());
2433 assume ((x->cols() == b->cols()) && (x->rows() == A->cols()) && (A->rows() == b->rows()));
2434
2435 switch (getCoeffType(R))
2436 {
2437 case n_Z:
2438 return solveAx_dixon(A, b, x, NULL);
2439 case n_Zn:
2440 case n_Znm:
2441 case n_Z2m:
2442 return solveAx_howell(A, b, x, NULL);
2443 case n_Zp:
2444 case n_Q:
2445 case n_GF:
2446 case n_algExt:
2447 case n_transExt:
2448 WarnS("have field, should use Gauss or better");
2449 break;
2450 default:
2451 if (R->cfXExtGcd && R->cfAnn)
2452 { //assume it's Euclidean
2453 return solveAx_howell(A, b, x, NULL);
2454 }
2455 WerrorS("have no solve algorithm");
2456 break;
2457 }
2458 return NULL;
2459}
static number solveAx_dixon(bigintmat *A, bigintmat *B, bigintmat *x, bigintmat *kern)
static number solveAx_howell(bigintmat *A, bigintmat *b, bigintmat *x, bigintmat *kern)
@ n_GF
\GF{p^n < 2^16}
Definition coeffs.h:32
@ n_Znm
only used if HAVE_RINGS is defined
Definition coeffs.h:45
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
@ n_Z2m
only used if HAVE_RINGS is defined
Definition coeffs.h:46
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
#define WarnS
Definition emacs.cc:78