My Project
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  if (a->cols() != b->cols()) return NULL;
282  if (a->cols() == 1)
283  {
284  int i;
285  intvec * iv;
286  int ma = si_max(a->rows(),b->rows()+s);
287  iv=new intvec(ma);
288  for (i=a->rows()-1;i>=0;i--)
289  (*iv)[i] = (*a)[i];
290  for(i=b->rows()+s-1;i>=s;i--)
291  (*iv)[i] += (*b)[i-s];
292  return iv;
293  }
294  return NULL;
295 }
296 
298 {
299  intvec * iv;
300  int mn, ma, i;
301  if (a->cols() != b->cols()) return NULL;
302  mn = si_min(a->rows(),b->rows());
303  ma = si_max(a->rows(),b->rows());
304  if (a->cols() == 1)
305  {
306  iv = new intvec(ma);
307  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
308  if (ma > mn)
309  {
310  if (ma == a->rows())
311  {
312  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
313  }
314  else
315  {
316  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
317  }
318  }
319  return iv;
320  }
321  if (mn != ma) return NULL;
322  iv = new intvec(a);
323  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
324  return iv;
325 }
326 
328 {
329  int i, j, r = o->rows(), c = o->cols();
330  intvec * iv= new intvec(c, r, 0);
331  for (i=0; i<r; i++)
332  {
333  for (j=0; j<c; j++)
334  (*iv)[j*r+i] = (*o)[i*c+j];
335  }
336  return iv;
337 }
338 
339 int ivTrace(intvec * o)
340 {
341  int i, s = 0, m = si_min(o->rows(),o->cols()), c = o->cols();
342  for (i=0; i<m; i++)
343  {
344  s += (*o)[i*c+i];
345  }
346  return s;
347 }
348 
350 {
351  int i, j, k, sum,
352  ra = a->rows(), ca = a->cols(),
353  rb = b->rows(), cb = b->cols();
354  intvec * iv;
355  if (ca != rb) return NULL;
356  iv = new intvec(ra, cb, 0);
357  for (i=0; i<ra; i++)
358  {
359  for (j=0; j<cb; j++)
360  {
361  sum = 0;
362  for (k=0; k<ca; k++)
363  sum += (*a)[i*ca+k]*(*b)[k*cb+j];
364  (*iv)[i*cb+j] = sum;
365  }
366  }
367  return iv;
368 }
369 
370 /*2
371 *computes a triangular matrix
372 */
373 //void ivTriangMat(intvec * imat)
374 //{
375 // int i=0,j=imat->rows(),k=j*imat->cols()-1;
376 //
377 // ivTriangIntern(imat,i,j);
378 // i *= imat->cols();
379 // for(j=k;j>=i;j--)
380 // (*imat)[j] = 0;
381 //}
382 
383 /* def. internals */
384 static int ivColPivot(intvec *, int, int, int, int);
385 static void ivNegRow(intvec *, int);
386 static void ivSaveRow(intvec *, int);
387 static void ivSetRow(intvec *, int, int);
388 static void ivFreeRow(intvec *, int, int);
389 static void ivReduce(intvec *, int, int, int, int);
390 static void ivZeroElim(intvec *,int, int, int &);
391 static void ivRowContent(intvec *, int, int);
392 static void ivKernFromRow(intvec *, intvec *, intvec *,
393  int, int, int);
394 static intvec * ivOptimizeKern(intvec *);
395 static int ivGcd(int, int);
396 static void ivOptRecursive(intvec *, intvec *, intvec *,
397  int &, int &, int);
398 static void ivOptSolve(intvec *, intvec *, int &, int &);
399 static void ivContent(intvec *);
400 static int ivL1Norm(intvec *);
401 static int ivCondNumber(intvec *, int);
402 
403 /* Triangulierung in intmat.cc */
404 void ivTriangIntern(intvec *imat, int &ready, int &all)
405 {
406  int rpiv, colpos=0, rowpos=0;
407  int ia=ready, ie=all;
408 
409  do
410  {
411  rowpos++;
412  do
413  {
414  colpos++;
415  rpiv = ivColPivot(imat, colpos, rowpos, ia, ie);
416  } while (rpiv==0);
417  if (rpiv>ia)
418  {
419  if (rowpos!=rpiv)
420  {
421  ivSaveRow(imat, rpiv);
422  ivFreeRow(imat, rowpos, rpiv);
423  ivSetRow(imat, rowpos, colpos);
424  rpiv = rowpos;
425  }
426  ia++;
427  if (ia==imat->cols())
428  {
429  ready = ia;
430  all = ie;
431  return;
432  }
433  }
434  ivReduce(imat, rpiv, colpos, ia, ie);
435  ivZeroElim(imat, colpos, ia, ie);
436  } while (ie>ia);
437  ready = ia;
438  all = ie;
439 }
440 
441 /* Kernberechnung in intmat.cc */
442 intvec * ivSolveKern(intvec *imat, int dimtr)
443 {
444  int d=imat->cols();
445  int kdim=d-dimtr;
446  intvec *perm = new intvec(dimtr+1);
447  intvec *kern = new intvec(kdim,d,0);
448  intvec *res;
449  int c, cp, r, t;
450 
451  t = kdim;
452  c = 1;
453  for (r=1;r<=dimtr;r++)
454  {
455  while (IMATELEM(*imat,r,c)==0) c++;
456  (*perm)[r] = c;
457  c++;
458  }
459  c = d;
460  for (r=dimtr;r>0;r--)
461  {
462  cp = (*perm)[r];
463  if (cp!=c)
464  {
465  ivKernFromRow(kern, imat, perm, t, r, c);
466  t -= (c-cp);
467  if (t==0)
468  break;
469  c = cp-1;
470  }
471  else
472  c--;
473  }
474  if (kdim>1)
475  res = ivOptimizeKern(kern);
476  else
477  res = ivTranp(kern);
478  delete kern;
479  delete perm;
480  return res;
481 }
482 
483 /* internals */
484 static int ivColPivot(intvec *imat, int colpos, int rowpos, int ready, int all)
485 {
486  int rpiv;
487 
488  if (IMATELEM(*imat,rowpos,colpos)!=0)
489  return rowpos;
490  for (rpiv=ready+1;rpiv<=all;rpiv++)
491  {
492  if (IMATELEM(*imat,rpiv,colpos)!=0)
493  return rpiv;
494  }
495  return 0;
496 }
497 
498 static void ivNegRow(intvec *imat, int rpiv)
499 {
500  int i;
501  for (i=imat->cols();i!=0;i--)
502  IMATELEM(*imat,rpiv,i) = -(IMATELEM(*imat,rpiv,i));
503 }
504 
505 static void ivSaveRow(intvec *imat, int rpiv)
506 {
507  int i, j=imat->rows();
508 
509  for (i=imat->cols();i!=0;i--)
510  IMATELEM(*imat,j,i) = IMATELEM(*imat,rpiv,i);
511 }
512 
513 static void ivSetRow(intvec *imat, int rowpos, int colpos)
514 {
515  int i, j=imat->rows();
516 
517  for (i=imat->cols();i!=0;i--)
518  IMATELEM(*imat,rowpos,i) = IMATELEM(*imat,j,i);
519  ivRowContent(imat, rowpos, colpos);
520 }
521 
522 static void ivFreeRow(intvec *imat, int rowpos, int rpiv)
523 {
524  int i, j;
525 
526  for (j=rpiv-1;j>=rowpos;j--)
527  {
528  for (i=imat->cols();i!=0;i--)
529  IMATELEM(*imat,j+1,i) = IMATELEM(*imat,j,i);
530  }
531 }
532 
533 static void ivReduce(intvec *imat, int rpiv, int colpos,
534  int ready, int all)
535 {
536  int tgcd, ce, m1, m2, j, i;
537  int piv = IMATELEM(*imat,rpiv,colpos);
538 
539  for (j=all;j>ready;j--)
540  {
541  ivRowContent(imat, j, 1);
542  ce = IMATELEM(*imat,j,colpos);
543  if (ce!=0)
544  {
545  IMATELEM(*imat,j,colpos) = 0;
546  m1 = piv;
547  m2 = ce;
548  tgcd = ivGcd(m1, m2);
549  if (tgcd != 1)
550  {
551  m1 /= tgcd;
552  m2 /= tgcd;
553  }
554  for (i=imat->cols();i>colpos;i--)
555  {
556  IMATELEM(*imat,j,i) = IMATELEM(*imat,j,i)*m1-
557  IMATELEM(*imat,rpiv,i)*m2;
558  }
559  ivRowContent(imat, j, colpos+1);
560  }
561  }
562 }
563 
564 static void ivZeroElim(intvec *imat, int colpos,
565  int ready, int &all)
566 {
567  int j, i, k, l;
568 
569  k = ready;
570  for (j=ready+1;j<=all;j++)
571  {
572  for (i=imat->cols();i>colpos;i--)
573  {
574  if (IMATELEM(*imat,j,i)!=0)
575  {
576  k++;
577  if (k<j)
578  {
579  for (l=imat->cols();l>colpos;l--)
580  IMATELEM(*imat,k,l) = IMATELEM(*imat,j,l);
581  }
582  break;
583  }
584  }
585  }
586  all = k;
587 }
588 
589 static void ivRowContent(intvec *imat, int rowpos, int colpos)
590 {
591  int tgcd, m;
592  int i=imat->cols();
593 
594  loop
595  {
596  tgcd = IMATELEM(*imat,rowpos,i--);
597  if (tgcd!=0) break;
598  if (i<colpos) return;
599  }
600  if (tgcd<0) tgcd = -tgcd;
601  if (tgcd==1) return;
602  loop
603  {
604  m = IMATELEM(*imat,rowpos,i--);
605  if (m!=0) tgcd= ivGcd(tgcd, m);
606  if (tgcd==1) return;
607  if (i<colpos) break;
608  }
609  for (i=imat->cols();i>=colpos;i--)
610  IMATELEM(*imat,rowpos,i) /= tgcd;
611 }
612 
613 static void ivKernFromRow(intvec *kern, intvec *imat,
614  intvec *perm, int pos, int r, int c)
615 {
616  int piv, cp, g, i, j, k, s;
617 
618  for (i=c;i>(*perm)[r];i--)
619  {
620  IMATELEM(*kern,pos,i) = 1;
621  for (j=r;j!=0;j--)
622  {
623  cp = (*perm)[j];
624  s=0;
625  for(k=c;k>cp;k--)
626  s += IMATELEM(*imat,j,k)*IMATELEM(*kern,pos,k);
627  if (s!=0)
628  {
629  piv = IMATELEM(*imat,j,cp);
630  g = ivGcd(piv,s);
631  if (g!=1)
632  {
633  s /= g;
634  piv /= g;
635  }
636  for(k=c;k>cp;k--)
637  IMATELEM(*kern,pos,k) *= piv;
638  IMATELEM(*kern,pos,cp) = -s;
639  ivRowContent(kern,pos,cp);
640  }
641  }
642  if (IMATELEM(*kern,pos,i)<0)
643  ivNegRow(kern,pos);
644  pos--;
645  }
646 }
647 
648 static int ivGcd(int a,int b)
649 {
650  int x;
651 
652  if (a<0) a=-a;
653  if (b<0) b=-b;
654  if (b>a)
655  {
656  x=b;
657  b=a;
658  a=x;
659  }
660  while (b!=0)
661  {
662  x = a % b;
663  a = b;
664  b = x;
665  }
666  return a;
667 }
668 
669 static intvec * ivOptimizeKern(intvec *kern)
670 {
671  int i,l,j,c=kern->cols(),r=kern->rows();
672  intvec *res=new intvec(c);
673 
674  if (TEST_OPT_PROT)
675  Warn(" %d linear independent solutions\n",r);
676  for (i=r;i>1;i--)
677  {
678  for (j=c;j>0;j--)
679  {
680  (*res)[j-1] += IMATELEM(*kern,i,j);
681  }
682  }
683  ivContent(res);
684  if (r<11)
685  {
686  l = ivCondNumber(res,-c);
687  j = ivL1Norm(res);
688  ivOptRecursive(res, NULL, kern, l, j, r);
689  }
690  return res;
691 }
692 
693 static void ivOptRecursive(intvec *res, intvec *w, intvec *kern,
694  int &l, int &j, int pos)
695 {
696  int m, k, d;
697  intvec *h;
698 
699  d=kern->rows();
700  d=96/(d*d);
701  if (d<3) d=3;
702  if (w!=0)
703  h = new intvec(w);
704  else
705  h = new intvec(res->rows());
706  for (m=d;m>0;m--)
707  {
708  for(k=h->rows()-1;k>=0;k--)
709  (*h)[k] += IMATELEM(*kern,pos,k+1);
710  if(pos>1)
711  ivOptRecursive(res, h, kern, l, j, pos-1);
712  else
713  ivOptSolve(res, h, l, j);
714  }
715  delete h;
716  if (pos>1)
717  ivOptRecursive(res, w, kern, l, j, pos-1);
718  else if (w!=NULL)
719  ivOptSolve(res, w, l, j);
720 }
721 
722 static void ivOptSolve(intvec *res, intvec *w, int &l, int &j)
723 {
724  int l0, j0, k;
725 
726  l0 = ivCondNumber(w, l);
727  if (l0==l)
728  {
729  ivContent(w);
730  j0 = ivL1Norm(w);
731  if(j0<j)
732  {
733  j = j0;
734  for(k=w->rows()-1;k>=0;k--)
735  (*res)[k] = (*w)[k];
736  }
737  return;
738  }
739  if(l0>l)
740  {
741  l = l0;
742  ivContent(w);
743  j = ivL1Norm(w);
744  for(k=w->rows()-1;k>=0;k--)
745  (*res)[k] = (*w)[k];
746  }
747 }
748 
749 static int ivL1Norm(intvec *w)
750 {
751  int i, j, s = 0;
752 
753  for (i=w->rows()-1;i>=0;i--)
754  {
755  j = (*w)[i];
756  if (j>0)
757  s += j;
758  else
759  s -= j;
760  }
761  return s;
762 }
763 
764 static int ivCondNumber(intvec *w, int l)
765 {
766  int l0=0, i;
767 
768  if (l<0)
769  {
770  for (i=w->rows()-1;i>=0;i--)
771  {
772  if ((*w)[i]<0) l0--;
773  }
774  if (l0==0)
775  {
776  for (i=w->rows()-1;i>=0;i--)
777  {
778  if ((*w)[i]>0) l0++;
779  }
780  }
781  return l0;
782  }
783  else
784  {
785  for (i=w->rows()-1;i>=0;i--)
786  {
787  if ((*w)[i]<0) return -1;
788  }
789  for (i=w->rows()-1;i>=0;i--)
790  {
791  if ((*w)[i]>0) l0++;
792  }
793  return l0;
794  }
795 }
796 
797 static void ivContent(intvec *w)
798 {
799  int tgcd, m;
800  int i=w->rows()-1;
801 
802  loop
803  {
804  tgcd = (*w)[i--];
805  if (tgcd!=0) break;
806  if (i<0) return;
807  }
808  if (tgcd<0) tgcd = -tgcd;
809  if (tgcd==1) return;
810  loop
811  {
812  m = (*w)[i--];
813  if (m!=0) tgcd= ivGcd(tgcd, m);
814  if (tgcd==1) return;
815  if (i<0) break;
816  }
817  for (i=w->rows()-1;i>=0;i--)
818  (*w)[i] /= tgcd;
819 }
820 
821 // columnwise concatination of two intvecs
823 {
824  int ac=a->cols();
825  int c = ac + b->cols(); int r = si_max(a->rows(),b->rows());
826  intvec * ab = new intvec(r,c,0);
827 
828  int i,j;
829  for (i=1; i<=a->rows(); i++)
830  {
831  for(j=1; j<=ac; j++)
832  IMATELEM(*ab,i,j) = IMATELEM(*a,i,j);
833  }
834  for (i=1; i<=b->rows(); i++)
835  {
836  for(j=1; j<=b->cols(); j++)
837  IMATELEM(*ab,i,j+ac) = IMATELEM(*b,i,j);
838  }
839  return ab;
840 }
841 
843 {
844  if (!range(p)) return NULL;
845  intvec *iv=new intvec(rows()-1);
846  for(int i=0;i<p;i++) (*iv)[i]=v[i];
847  for(int i=p+1;i<rows();i++) (*iv)[i-1]=v[i];
848  return iv;
849 }
850 
851 #pragma GCC pop_options
852 
853 #endif
All the auxiliary stuff.
static int ABS(int v)
Definition: auxiliary.h:112
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
Variable x
Definition: cfModGcd.cc:4082
int p
Definition: cfModGcd.cc:4078
g
Definition: cfModGcd.cc:4090
CanonicalForm b
Definition: cfModGcd.cc:4103
Definition: intvec.h:23
intvec * delete_pos(int p)
Definition: intvec.cc:842
intvec(int l=1)
Definition: intvec.h:30
int range(int i) const
Definition: intvec.h:59
void resize(int new_length)
Definition: intvec.cc:106
void operator%=(int intop)
Definition: intvec.cc:193
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:149
int col
Definition: intvec.h:27
int length() const
Definition: intvec.h:94
void operator/=(int intop)
Definition: intvec.cc:179
void operator+=(int intop)
Definition: intvec.cc:164
char * String(int dim=2) const
Definition: intvec.cc:127
int compare(const intvec *o) const
Definition: intvec.cc:206
int row
Definition: intvec.h:26
int * v
Definition: intvec.h:25
char * ivString(int not_mat=1, int spaces=0, int dim=2) const
Definition: intvec.cc:58
void operator*=(int intop)
Definition: intvec.cc:174
void operator-=(int intop)
Definition: intvec.cc:169
int cols() const
Definition: intvec.h:95
int rows() const
Definition: intvec.h:96
void view() const
Definition: intvec.cc:134
#define Print
Definition: emacs.cc:80
#define Warn
Definition: emacs.cc:77
#define StringAppend
Definition: emacs.cc:79
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
const CanonicalForm & w
Definition: facAbsFact.cc:51
int j
Definition: facHensel.cc:110
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:589
int ivTrace(intvec *o)
Definition: intvec.cc:339
intvec * ivSub(intvec *a, intvec *b)
Definition: intvec.cc:297
static void ivOptRecursive(intvec *, intvec *, intvec *, int &, int &, int)
Definition: intvec.cc:693
static intvec * ivOptimizeKern(intvec *)
Definition: intvec.cc:669
intvec * ivConcat(intvec *a, intvec *b)
Definition: intvec.cc:822
static int ivGcd(int, int)
Definition: intvec.cc:648
static void ivOptSolve(intvec *, intvec *, int &, int &)
Definition: intvec.cc:722
void ivTriangIntern(intvec *imat, int &ready, int &all)
Definition: intvec.cc:404
static void ivKernFromRow(intvec *, intvec *, intvec *, int, int, int)
Definition: intvec.cc:613
static int ivColPivot(intvec *, int, int, int, int)
Definition: intvec.cc:484
intvec * ivTranp(intvec *o)
Definition: intvec.cc:327
static void ivSetRow(intvec *, int, int)
Definition: intvec.cc:513
static void ivFreeRow(intvec *, int, int)
Definition: intvec.cc:522
static void ivZeroElim(intvec *, int, int, int &)
Definition: intvec.cc:564
static int ivL1Norm(intvec *)
Definition: intvec.cc:749
static void ivSaveRow(intvec *, int)
Definition: intvec.cc:505
static void ivContent(intvec *)
Definition: intvec.cc:797
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:764
static void ivNegRow(intvec *, int)
Definition: intvec.cc:498
intvec * ivMult(intvec *a, intvec *b)
Definition: intvec.cc:349
intvec * ivSolveKern(intvec *imat, int dimtr)
Definition: intvec.cc:442
static void ivReduce(intvec *, int, int, int, int)
Definition: intvec.cc:533
intvec * ivAddShift(intvec *a, intvec *b, int s)
Definition: intvec.cc:279
intvec * ivAdd(intvec *a, intvec *b)
Definition: intvec.cc:249
#define IMATELEM(M, I, J)
Definition: intvec.h:85
STATIC_VAR Poly * h
Definition: janet.cc:971
#define assume(x)
Definition: mod2.h:389
void init()
Definition: lintree.cc:864
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define NULL
Definition: omList.c:12
#define TEST_OPT_PROT
Definition: options.h:104
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
void PrintNSpaces(const int n)
Definition: reporter.cc:364
void PrintS(const char *s)
Definition: reporter.cc:284
char * StringEndS()
Definition: reporter.cc:151
void PrintLn()
Definition: reporter.cc:310
#define loop
Definition: structs.h:75
int dim(ideal I, ring r)