intvec.cc
Go to the documentation of this file.
1 /*****************************************
2 * Computer Algebra System SINGULAR *
3 *****************************************/
4 /*
5 * ABSTRACT: class intvec: lists/vectors of integers
6 */
7 #ifndef INTVEC_CC
8 #define INTVEC_CC
9 
10 #include "misc/auxiliary.h"
11 
12 #include "misc/intvec.h"
13 #include "misc/options.h"
14 #include "omalloc/omalloc.h"
15 
16 #pragma GCC push_options
17 #pragma GCC optimize ("wrapv")
18 
19 /*0 implementation*/
20 
21 intvec::intvec(int s, int e)
22 {
23  int inc;
24  col = 1;
25  if (s<e)
26  {
27  row = e-s+1;
28  inc = 1;
29  }
30  else
31  {
32  row = s-e+1;
33  inc = -1;
34  }
35  v = (int *)omAlloc(sizeof(int)*row);
36  for (int i=0; i<row; i++)
37  {
38  v[i] = s;
39  s+=inc;
40  }
41 }
42 
43 intvec::intvec(int r, int c, int init)
44 {
45  row = r;
46  col = c;
47  int l = r*c;
48  if (l>0) /*(r>0) && (c>0) */
49  v = (int *)omAlloc(sizeof(int)*l);
50  else
51  v = NULL;
52  for (int i=0; i<l; i++)
53  {
54  v[i] = init;
55  }
56 }
57 
58 char * intvec::ivString(int not_mat,int spaces, int dim) const
59 {
60  //Print("ivString:this=%x,v=%x,row=%d\n",this,v,row);
61 #ifndef OM_NDEBUG
62  omCheckAddr((void *)this);
63  if (v!=NULL) omCheckAddr((void *)v);
64 #endif
65  StringSetS("");
66  if ((col == 1)&&(not_mat))
67  {
68  int i=0;
69  for (; i<row-1; i++)
70  {
71  StringAppend("%d,",v[i]);
72  }
73  if (i<row)
74  {
75  StringAppend("%d",v[i]);
76  }
77  }
78  else
79  {
80  for (int j=0; j<row; j++)
81  {
82  if (j<row-1)
83  {
84  for (int i=0; i<col; i++)
85  {
86  StringAppend("%d%c",v[j*col+i],',');
87  }
88  }
89  else
90  {
91  for (int i=0; i<col; i++)
92  {
93  StringAppend("%d%c",v[j*col+i],i<col-1 ? ',' : ' ');
94  }
95  }
96  if (j+1<row)
97  {
98  if (dim > 1) StringAppendS("\n");
99  if (spaces>0) StringAppend("%-*.*s",spaces,spaces," ");
100  }
101  }
102  }
103  return StringEndS();
104 }
105 
106 void intvec::resize(int new_length)
107 {
108  assume(new_length >= 0 && col == 1);
109  if (new_length==0)
110  {
111  if (v!=NULL)
112  {
113  omFreeSize(v, row*sizeof(int));
114  v=NULL;
115  }
116  }
117  else
118  {
119  if (v!=NULL)
120  v = (int*) omRealloc0Size(v, row*sizeof(int), new_length*sizeof(int));
121  else
122  v = (int*) omAlloc0(new_length*sizeof(int));
123  }
124  row = new_length;
125 }
126 
127 char * intvec::String(int dim) const
128 {
129  return ivString(1, 0, dim);
130 }
131 
132 #ifndef SING_NDEBUG
133 // debug only
134 void intvec::view () const
135 {
136  Print ("intvec: {rows: %d, cols: %d, length: %d, Values: \n", rows(), cols(), length());
137 
138  for (int i = 0; i < rows(); i++)
139  {
140  Print ("Row[%3d]:", i);
141  for (int j = 0; j < cols(); j++)
142  Print (" %5d", this->operator[]((i)*cols()+j) );
143  PrintLn ();
144  }
145  PrintS ("}\n");
146 }
147 #endif
148 
149 void intvec::show(int notmat,int spaces) const
150 {
151  char *s=ivString(notmat,spaces);
152  if (spaces>0)
153  {
154  PrintNSpaces(spaces);
155  PrintS(s);
156  }
157  else
158  {
159  PrintS(s);
160  }
161  omFree(s);
162 }
163 
164 void intvec::operator+=(int intop)
165 {
166  for (int i=0; i<row*col; i++) { v[i] += intop; }
167 }
168 
169 void intvec::operator-=(int intop)
170 {
171  for (int i=0; i<row*col; i++) { v[i] -= intop; }
172 }
173 
174 void intvec::operator*=(int intop)
175 {
176  for (int i=0; i<row*col; i++) { v[i] *= intop; }
177 }
178 
179 void intvec::operator/=(int intop)
180 {
181  if (intop == 0) return;
182  int bb=ABS(intop);
183  for (int i=0; i<row*col; i++)
184  {
185  int r=v[i];
186  int c=r%bb;
187  if (c<0) c+=bb;
188  r=(r-c)/intop;
189  v[i]=r;
190  }
191 }
192 
193 void intvec::operator%=(int intop)
194 {
195  if (intop == 0) return;
196  int bb=ABS(intop);
197  for (int i=0; i<row*col; i++)
198  {
199  int r=v[i];
200  int c=r%bb;
201  if (c<0) c+=bb;
202  v[i]=c;
203  }
204 }
205 
206 int intvec::compare(const intvec* op) const
207 {
208  if ((col!=1) ||(op->cols()!=1))
209  {
210  if((col!=op->cols())
211  || (row!=op->rows()))
212  return -2;
213  }
214  int i;
215  for (i=0; i<si_min(length(),op->length()); i++)
216  {
217  if (v[i] > (*op)[i])
218  return 1;
219  if (v[i] < (*op)[i])
220  return -1;
221  }
222  // this can only happen for intvec: (i.e. col==1)
223  for (; i<row; i++)
224  {
225  if (v[i] > 0)
226  return 1;
227  if (v[i] < 0)
228  return -1;
229  }
230  for (; i<op->rows(); i++)
231  {
232  if (0 > (*op)[i])
233  return 1;
234  if (0 < (*op)[i])
235  return -1;
236  }
237  return 0;
238 }
239 int intvec::compare(int o) const
240 {
241  for (int i=0; i<row*col; i++)
242  {
243  if (v[i] <o) return -1;
244  if (v[i] >o) return 1;
245  }
246  return 0;
247 }
248 
250 {
251  intvec * iv;
252  int mn, ma, i;
253  if (a->cols() != b->cols()) return NULL;
254  mn = si_min(a->rows(),b->rows());
255  ma = si_max(a->rows(),b->rows());
256  if (a->cols() == 1)
257  {
258  iv = new intvec(ma);
259  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
260  if (ma > mn)
261  {
262  if (ma == a->rows())
263  {
264  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
265  }
266  else
267  {
268  for(i=mn; i<ma; i++) (*iv)[i] = (*b)[i];
269  }
270  }
271  return iv;
272  }
273  if (mn != ma) return NULL;
274  iv = new intvec(a);
275  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
276  return iv;
277 }
278 
280 {
281  intvec * iv;
282  int mn, ma, i;
283  if (a->cols() != b->cols()) return NULL;
284  mn = si_min(a->rows(),b->rows());
285  ma = si_max(a->rows(),b->rows());
286  if (a->cols() == 1)
287  {
288  iv = new intvec(ma);
289  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
290  if (ma > mn)
291  {
292  if (ma == a->rows())
293  {
294  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
295  }
296  else
297  {
298  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
299  }
300  }
301  return iv;
302  }
303  if (mn != ma) return NULL;
304  iv = new intvec(a);
305  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
306  return iv;
307 }
308 
310 {
311  int i, j, r = o->rows(), c = o->cols();
312  intvec * iv= new intvec(c, r, 0);
313  for (i=0; i<r; i++)
314  {
315  for (j=0; j<c; j++)
316  (*iv)[j*r+i] = (*o)[i*c+j];
317  }
318  return iv;
319 }
320 
321 int ivTrace(intvec * o)
322 {
323  int i, s = 0, m = si_min(o->rows(),o->cols()), c = o->cols();
324  for (i=0; i<m; i++)
325  {
326  s += (*o)[i*c+i];
327  }
328  return s;
329 }
330 
332 {
333  int i, j, k, sum,
334  ra = a->rows(), ca = a->cols(),
335  rb = b->rows(), cb = b->cols();
336  intvec * iv;
337  if (ca != rb) return NULL;
338  iv = new intvec(ra, cb, 0);
339  for (i=0; i<ra; i++)
340  {
341  for (j=0; j<cb; j++)
342  {
343  sum = 0;
344  for (k=0; k<ca; k++)
345  sum += (*a)[i*ca+k]*(*b)[k*cb+j];
346  (*iv)[i*cb+j] = sum;
347  }
348  }
349  return iv;
350 }
351 
352 /*2
353 *computes a triangular matrix
354 */
355 //void ivTriangMat(intvec * imat)
356 //{
357 // int i=0,j=imat->rows(),k=j*imat->cols()-1;
358 //
359 // ivTriangIntern(imat,i,j);
360 // i *= imat->cols();
361 // for(j=k;j>=i;j--)
362 // (*imat)[j] = 0;
363 //}
364 
365 /* def. internals */
366 static int ivColPivot(intvec *, int, int, int, int);
367 static void ivNegRow(intvec *, int);
368 static void ivSaveRow(intvec *, int);
369 static void ivSetRow(intvec *, int, int);
370 static void ivFreeRow(intvec *, int, int);
371 static void ivReduce(intvec *, int, int, int, int);
372 static void ivZeroElim(intvec *,int, int, int &);
373 static void ivRowContent(intvec *, int, int);
374 static void ivKernFromRow(intvec *, intvec *, intvec *,
375  int, int, int);
376 static intvec * ivOptimizeKern(intvec *);
377 static int ivGcd(int, int);
378 static void ivOptRecursive(intvec *, intvec *, intvec *,
379  int &, int &, int);
380 static void ivOptSolve(intvec *, intvec *, int &, int &);
381 static void ivContent(intvec *);
382 static int ivL1Norm(intvec *);
383 static int ivCondNumber(intvec *, int);
384 
385 /* Triangulierung in intmat.cc */
386 void ivTriangIntern(intvec *imat, int &ready, int &all)
387 {
388  int rpiv, colpos=0, rowpos=0;
389  int ia=ready, ie=all;
390 
391  do
392  {
393  rowpos++;
394  do
395  {
396  colpos++;
397  rpiv = ivColPivot(imat, colpos, rowpos, ia, ie);
398  } while (rpiv==0);
399  if (rpiv>ia)
400  {
401  if (rowpos!=rpiv)
402  {
403  ivSaveRow(imat, rpiv);
404  ivFreeRow(imat, rowpos, rpiv);
405  ivSetRow(imat, rowpos, colpos);
406  rpiv = rowpos;
407  }
408  ia++;
409  if (ia==imat->cols())
410  {
411  ready = ia;
412  all = ie;
413  return;
414  }
415  }
416  ivReduce(imat, rpiv, colpos, ia, ie);
417  ivZeroElim(imat, colpos, ia, ie);
418  } while (ie>ia);
419  ready = ia;
420  all = ie;
421 }
422 
423 /* Kernberechnung in intmat.cc */
424 intvec * ivSolveKern(intvec *imat, int dimtr)
425 {
426  int d=imat->cols();
427  int kdim=d-dimtr;
428  intvec *perm = new intvec(dimtr+1);
429  intvec *kern = new intvec(kdim,d,0);
430  intvec *res;
431  int c, cp, r, t;
432 
433  t = kdim;
434  c = 1;
435  for (r=1;r<=dimtr;r++)
436  {
437  while (IMATELEM(*imat,r,c)==0) c++;
438  (*perm)[r] = c;
439  c++;
440  }
441  c = d;
442  for (r=dimtr;r>0;r--)
443  {
444  cp = (*perm)[r];
445  if (cp!=c)
446  {
447  ivKernFromRow(kern, imat, perm, t, r, c);
448  t -= (c-cp);
449  if (t==0)
450  break;
451  c = cp-1;
452  }
453  else
454  c--;
455  }
456  if (kdim>1)
457  res = ivOptimizeKern(kern);
458  else
459  res = ivTranp(kern);
460  delete kern;
461  delete perm;
462  return res;
463 }
464 
465 /* internals */
466 static int ivColPivot(intvec *imat, int colpos, int rowpos, int ready, int all)
467 {
468  int rpiv;
469 
470  if (IMATELEM(*imat,rowpos,colpos)!=0)
471  return rowpos;
472  for (rpiv=ready+1;rpiv<=all;rpiv++)
473  {
474  if (IMATELEM(*imat,rpiv,colpos)!=0)
475  return rpiv;
476  }
477  return 0;
478 }
479 
480 static void ivNegRow(intvec *imat, int rpiv)
481 {
482  int i;
483  for (i=imat->cols();i!=0;i--)
484  IMATELEM(*imat,rpiv,i) = -(IMATELEM(*imat,rpiv,i));
485 }
486 
487 static void ivSaveRow(intvec *imat, int rpiv)
488 {
489  int i, j=imat->rows();
490 
491  for (i=imat->cols();i!=0;i--)
492  IMATELEM(*imat,j,i) = IMATELEM(*imat,rpiv,i);
493 }
494 
495 static void ivSetRow(intvec *imat, int rowpos, int colpos)
496 {
497  int i, j=imat->rows();
498 
499  for (i=imat->cols();i!=0;i--)
500  IMATELEM(*imat,rowpos,i) = IMATELEM(*imat,j,i);
501  ivRowContent(imat, rowpos, colpos);
502 }
503 
504 static void ivFreeRow(intvec *imat, int rowpos, int rpiv)
505 {
506  int i, j;
507 
508  for (j=rpiv-1;j>=rowpos;j--)
509  {
510  for (i=imat->cols();i!=0;i--)
511  IMATELEM(*imat,j+1,i) = IMATELEM(*imat,j,i);
512  }
513 }
514 
515 static void ivReduce(intvec *imat, int rpiv, int colpos,
516  int ready, int all)
517 {
518  int tgcd, ce, m1, m2, j, i;
519  int piv = IMATELEM(*imat,rpiv,colpos);
520 
521  for (j=all;j>ready;j--)
522  {
523  ivRowContent(imat, j, 1);
524  ce = IMATELEM(*imat,j,colpos);
525  if (ce!=0)
526  {
527  IMATELEM(*imat,j,colpos) = 0;
528  m1 = piv;
529  m2 = ce;
530  tgcd = ivGcd(m1, m2);
531  if (tgcd != 1)
532  {
533  m1 /= tgcd;
534  m2 /= tgcd;
535  }
536  for (i=imat->cols();i>colpos;i--)
537  {
538  IMATELEM(*imat,j,i) = IMATELEM(*imat,j,i)*m1-
539  IMATELEM(*imat,rpiv,i)*m2;
540  }
541  ivRowContent(imat, j, colpos+1);
542  }
543  }
544 }
545 
546 static void ivZeroElim(intvec *imat, int colpos,
547  int ready, int &all)
548 {
549  int j, i, k, l;
550 
551  k = ready;
552  for (j=ready+1;j<=all;j++)
553  {
554  for (i=imat->cols();i>colpos;i--)
555  {
556  if (IMATELEM(*imat,j,i)!=0)
557  {
558  k++;
559  if (k<j)
560  {
561  for (l=imat->cols();l>colpos;l--)
562  IMATELEM(*imat,k,l) = IMATELEM(*imat,j,l);
563  }
564  break;
565  }
566  }
567  }
568  all = k;
569 }
570 
571 static void ivRowContent(intvec *imat, int rowpos, int colpos)
572 {
573  int tgcd, m;
574  int i=imat->cols();
575 
576  loop
577  {
578  tgcd = IMATELEM(*imat,rowpos,i--);
579  if (tgcd!=0) break;
580  if (i<colpos) return;
581  }
582  if (tgcd<0) tgcd = -tgcd;
583  if (tgcd==1) return;
584  loop
585  {
586  m = IMATELEM(*imat,rowpos,i--);
587  if (m!=0) tgcd= ivGcd(tgcd, m);
588  if (tgcd==1) return;
589  if (i<colpos) break;
590  }
591  for (i=imat->cols();i>=colpos;i--)
592  IMATELEM(*imat,rowpos,i) /= tgcd;
593 }
594 
595 static void ivKernFromRow(intvec *kern, intvec *imat,
596  intvec *perm, int pos, int r, int c)
597 {
598  int piv, cp, g, i, j, k, s;
599 
600  for (i=c;i>(*perm)[r];i--)
601  {
602  IMATELEM(*kern,pos,i) = 1;
603  for (j=r;j!=0;j--)
604  {
605  cp = (*perm)[j];
606  s=0;
607  for(k=c;k>cp;k--)
608  s += IMATELEM(*imat,j,k)*IMATELEM(*kern,pos,k);
609  if (s!=0)
610  {
611  piv = IMATELEM(*imat,j,cp);
612  g = ivGcd(piv,s);
613  if (g!=1)
614  {
615  s /= g;
616  piv /= g;
617  }
618  for(k=c;k>cp;k--)
619  IMATELEM(*kern,pos,k) *= piv;
620  IMATELEM(*kern,pos,cp) = -s;
621  ivRowContent(kern,pos,cp);
622  }
623  }
624  if (IMATELEM(*kern,pos,i)<0)
625  ivNegRow(kern,pos);
626  pos--;
627  }
628 }
629 
630 static int ivGcd(int a,int b)
631 {
632  int x;
633 
634  if (a<0) a=-a;
635  if (b<0) b=-b;
636  if (b>a)
637  {
638  x=b;
639  b=a;
640  a=x;
641  }
642  while (b!=0)
643  {
644  x = a % b;
645  a = b;
646  b = x;
647  }
648  return a;
649 }
650 
651 static intvec * ivOptimizeKern(intvec *kern)
652 {
653  int i,l,j,c=kern->cols(),r=kern->rows();
654  intvec *res=new intvec(c);
655 
656  if (TEST_OPT_PROT)
657  Warn(" %d linear independent solutions\n",r);
658  for (i=r;i>1;i--)
659  {
660  for (j=c;j>0;j--)
661  {
662  (*res)[j-1] += IMATELEM(*kern,i,j);
663  }
664  }
665  ivContent(res);
666  if (r<11)
667  {
668  l = ivCondNumber(res,-c);
669  j = ivL1Norm(res);
670  ivOptRecursive(res, NULL, kern, l, j, r);
671  }
672  return res;
673 }
674 
675 static void ivOptRecursive(intvec *res, intvec *w, intvec *kern,
676  int &l, int &j, int pos)
677 {
678  int m, k, d;
679  intvec *h;
680 
681  d=kern->rows();
682  d=96/(d*d);
683  if (d<3) d=3;
684  if (w!=0)
685  h = new intvec(w);
686  else
687  h = new intvec(res->rows());
688  for (m=d;m>0;m--)
689  {
690  for(k=h->rows()-1;k>=0;k--)
691  (*h)[k] += IMATELEM(*kern,pos,k+1);
692  if(pos>1)
693  ivOptRecursive(res, h, kern, l, j, pos-1);
694  else
695  ivOptSolve(res, h, l, j);
696  }
697  delete h;
698  if (pos>1)
699  ivOptRecursive(res, w, kern, l, j, pos-1);
700  else if (w!=NULL)
701  ivOptSolve(res, w, l, j);
702 }
703 
704 static void ivOptSolve(intvec *res, intvec *w, int &l, int &j)
705 {
706  int l0, j0, k;
707 
708  l0 = ivCondNumber(w, l);
709  if (l0==l)
710  {
711  ivContent(w);
712  j0 = ivL1Norm(w);
713  if(j0<j)
714  {
715  j = j0;
716  for(k=w->rows()-1;k>=0;k--)
717  (*res)[k] = (*w)[k];
718  }
719  return;
720  }
721  if(l0>l)
722  {
723  l = l0;
724  ivContent(w);
725  j = ivL1Norm(w);
726  for(k=w->rows()-1;k>=0;k--)
727  (*res)[k] = (*w)[k];
728  }
729 }
730 
731 static int ivL1Norm(intvec *w)
732 {
733  int i, j, s = 0;
734 
735  for (i=w->rows()-1;i>=0;i--)
736  {
737  j = (*w)[i];
738  if (j>0)
739  s += j;
740  else
741  s -= j;
742  }
743  return s;
744 }
745 
746 static int ivCondNumber(intvec *w, int l)
747 {
748  int l0=0, i;
749 
750  if (l<0)
751  {
752  for (i=w->rows()-1;i>=0;i--)
753  {
754  if ((*w)[i]<0) l0--;
755  }
756  if (l0==0)
757  {
758  for (i=w->rows()-1;i>=0;i--)
759  {
760  if ((*w)[i]>0) l0++;
761  }
762  }
763  return l0;
764  }
765  else
766  {
767  for (i=w->rows()-1;i>=0;i--)
768  {
769  if ((*w)[i]<0) return -1;
770  }
771  for (i=w->rows()-1;i>=0;i--)
772  {
773  if ((*w)[i]>0) l0++;
774  }
775  return l0;
776  }
777 }
778 
779 static void ivContent(intvec *w)
780 {
781  int tgcd, m;
782  int i=w->rows()-1;
783 
784  loop
785  {
786  tgcd = (*w)[i--];
787  if (tgcd!=0) break;
788  if (i<0) return;
789  }
790  if (tgcd<0) tgcd = -tgcd;
791  if (tgcd==1) return;
792  loop
793  {
794  m = (*w)[i--];
795  if (m!=0) tgcd= ivGcd(tgcd, m);
796  if (tgcd==1) return;
797  if (i<0) break;
798  }
799  for (i=w->rows()-1;i>=0;i--)
800  (*w)[i] /= tgcd;
801 }
802 
803 // columnwise concatination of two intvecs
805 {
806  int ac=a->cols();
807  int c = ac + b->cols(); int r = si_max(a->rows(),b->rows());
808  intvec * ab = new intvec(r,c,0);
809 
810  int i,j;
811  for (i=1; i<=a->rows(); i++)
812  {
813  for(j=1; j<=ac; j++)
814  IMATELEM(*ab,i,j) = IMATELEM(*a,i,j);
815  }
816  for (i=1; i<=b->rows(); i++)
817  {
818  for(j=1; j<=b->cols(); j++)
819  IMATELEM(*ab,i,j+ac) = IMATELEM(*b,i,j);
820  }
821  return ab;
822 }
823 
825 {
826  if (!range(p)) return NULL;
827  intvec *iv=new intvec(rows()-1);
828  for(int i=0;i<p;i++) (*iv)[i]=v[i];
829  for(int i=p+1;i<rows();i++) (*iv)[i-1]=v[i];
830  return iv;
831 }
832 
833 #pragma GCC pop_options
834 
835 #endif
int compare(const intvec *o) const
Definition: intvec.cc:206
void operator-=(int intop)
Definition: intvec.cc:169
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
const CanonicalForm int s
Definition: facAbsFact.cc:55
int j
Definition: facHensel.cc:105
static void ivNegRow(intvec *, int)
Definition: intvec.cc:480
void resize(int new_length)
Definition: intvec.cc:106
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
char * ivString(int not_mat=1, int spaces=0, int dim=2) const
Definition: intvec.cc:58
static intvec * ivOptimizeKern(intvec *)
Definition: intvec.cc:651
#define TEST_OPT_PROT
Definition: options.h:102
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
static void ivZeroElim(intvec *, int, int, int &)
Definition: intvec.cc:546
void view() const
Definition: intvec.cc:134
static int ivL1Norm(intvec *)
Definition: intvec.cc:731
static int ivGcd(int, int)
Definition: intvec.cc:630
intvec(int l=1)
Definition: intvec.h:28
int rows() const
Definition: intvec.h:94
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void operator/=(int intop)
Definition: intvec.cc:179
static void ivFreeRow(intvec *, int, int)
Definition: intvec.cc:504
intvec * ivSub(intvec *a, intvec *b)
Definition: intvec.cc:279
intvec * ivTranp(intvec *o)
Definition: intvec.cc:309
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:92
char * StringEndS()
Definition: reporter.cc:151
static void ivSaveRow(intvec *, int)
Definition: intvec.cc:487
#define loop
Definition: structs.h:78
#define omAlloc(size)
Definition: omAllocDecl.h:210
void operator+=(int intop)
Definition: intvec.cc:164
static void ivContent(intvec *)
Definition: intvec.cc:779
int * v
Definition: intvec.h:23
CanonicalForm b
Definition: cfModGcd.cc:4044
int row
Definition: intvec.h:24
static int ivColPivot(intvec *, int, int, int, int)
Definition: intvec.cc:466
Definition: intvec.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
void operator%=(int intop)
Definition: intvec.cc:193
#define omFree(addr)
Definition: omAllocDecl.h:261
void ivTriangIntern(intvec *imat, int &ready, int &all)
Definition: intvec.cc:386
#define assume(x)
Definition: mod2.h:390
void StringSetS(const char *st)
Definition: reporter.cc:128
void operator*=(int intop)
Definition: intvec.cc:174
void StringAppendS(const char *st)
Definition: reporter.cc:107
All the auxiliary stuff.
int m
Definition: cfEzgcd.cc:121
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int dim(ideal I, ring r)
#define StringAppend
Definition: emacs.cc:79
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
static int ABS(int v)
Definition: auxiliary.h:110
static void ivOptRecursive(intvec *, intvec *, intvec *, int &, int &, int)
Definition: intvec.cc:675
intvec * ivConcat(intvec *a, intvec *b)
Definition: intvec.cc:804
static void ivReduce(intvec *, int, int, int, int)
Definition: intvec.cc:515
static void ivSetRow(intvec *, int, int)
Definition: intvec.cc:495
intvec * ivMult(intvec *a, intvec *b)
Definition: intvec.cc:331
int range(int i) const
Definition: intvec.h:57
char * String(int dim=2) const
Definition: intvec.cc:127
int col
Definition: intvec.h:25
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:92
static void ivKernFromRow(intvec *, intvec *, intvec *, int, int, int)
Definition: intvec.cc:595
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:149
const CanonicalForm & w
Definition: facAbsFact.cc:55
int cols() const
Definition: intvec.h:93
Variable x
Definition: cfModGcd.cc:4023
intvec * delete_pos(int p)
Definition: intvec.cc:824
intvec * ivSolveKern(intvec *imat, int dimtr)
Definition: intvec.cc:424
static void ivOptSolve(intvec *, intvec *, int &, int &)
Definition: intvec.cc:704
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int p
Definition: cfModGcd.cc:4019
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:571
static Poly * h
Definition: janet.cc:972
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:746
#define IMATELEM(M, I, J)
Definition: intvec.h:83
void PrintNSpaces(const int n)
Definition: reporter.cc:364
int ivTrace(intvec *o)
Definition: intvec.cc:321
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:93
intvec * ivAdd(intvec *a, intvec *b)
Definition: intvec.cc:249
#define Warn
Definition: emacs.cc:77