Macros | Functions
intvec.cc File Reference
#include <misc/auxiliary.h>
#include <misc/intvec.h>
#include <misc/options.h>
#include <omalloc/omalloc.h>

Go to the source code of this file.

Macros

#define INTVEC_CC
 

Functions

intvecivAdd (intvec *a, intvec *b)
 
intvecivSub (intvec *a, intvec *b)
 
intvecivTranp (intvec *o)
 
int ivTrace (intvec *o)
 
intvecivMult (intvec *a, intvec *b)
 
static int ivColPivot (intvec *, int, int, int, int)
 
static void ivNegRow (intvec *, int)
 
static void ivSaveRow (intvec *, int)
 
static void ivSetRow (intvec *, int, int)
 
static void ivFreeRow (intvec *, int, int)
 
static void ivReduce (intvec *, int, int, int, int)
 
static void ivZeroElim (intvec *, int, int, int &)
 
static void ivRowContent (intvec *, int, int)
 
static void ivKernFromRow (intvec *, intvec *, intvec *, int, int, int)
 
static intvecivOptimizeKern (intvec *)
 
static int ivGcd (int, int)
 
static void ivOptRecursive (intvec *, intvec *, intvec *, int &, int &, int)
 
static void ivOptSolve (intvec *, intvec *, int &, int &)
 
static void ivContent (intvec *)
 
static int ivL1Norm (intvec *)
 
static int ivCondNumber (intvec *, int)
 
void ivTriangIntern (intvec *imat, int &ready, int &all)
 
intvecivSolveKern (intvec *imat, int dimtr)
 
intvecivConcat (intvec *a, intvec *b)
 

Macro Definition Documentation

§ INTVEC_CC

#define INTVEC_CC

Definition at line 8 of file intvec.cc.

Function Documentation

§ ivAdd()

intvec* ivAdd ( intvec a,
intvec b 
)

Definition at line 250 of file intvec.cc.

251 {
252  intvec * iv;
253  int mn, ma, i;
254  if (a->cols() != b->cols()) return NULL;
255  mn = si_min(a->rows(),b->rows());
256  ma = si_max(a->rows(),b->rows());
257  if (a->cols() == 1)
258  {
259  iv = new intvec(ma);
260  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
261  if (ma > mn)
262  {
263  if (ma == a->rows())
264  {
265  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
266  }
267  else
268  {
269  for(i=mn; i<ma; i++) (*iv)[i] = (*b)[i];
270  }
271  }
272  return iv;
273  }
274  if (mn != ma) return NULL;
275  iv = new intvec(a);
276  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
277  return iv;
278 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:124
int rows() const
Definition: intvec.h:88
Definition: intvec.h:14
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87

§ ivColPivot()

static int ivColPivot ( intvec imat,
int  colpos,
int  rowpos,
int  ready,
int  all 
)
static

Definition at line 467 of file intvec.cc.

468 {
469  int rpiv;
470 
471  if (IMATELEM(*imat,rowpos,colpos)!=0)
472  return rowpos;
473  for (rpiv=ready+1;rpiv<=all;rpiv++)
474  {
475  if (IMATELEM(*imat,rpiv,colpos)!=0)
476  return rpiv;
477  }
478  return 0;
479 }
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivConcat()

intvec* ivConcat ( intvec a,
intvec b 
)

Definition at line 805 of file intvec.cc.

806 {
807  int ac=a->cols();
808  int c = ac + b->cols(); int r = si_max(a->rows(),b->rows());
809  intvec * ab = new intvec(r,c,0);
810 
811  int i,j;
812  for (i=1; i<=a->rows(); i++)
813  {
814  for(j=1; j<=ac; j++)
815  IMATELEM(*ab,i,j) = IMATELEM(*a,i,j);
816  }
817  for (i=1; i<=b->rows(); i++)
818  {
819  for(j=1; j<=b->cols(); j++)
820  IMATELEM(*ab,i,j+ac) = IMATELEM(*b,i,j);
821  }
822  return ab;
823 }
int rows() const
Definition: intvec.h:88
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int j
Definition: myNF.cc:70
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivCondNumber()

static int ivCondNumber ( intvec w,
int  l 
)
static

Definition at line 747 of file intvec.cc.

748 {
749  int l0=0, i;
750 
751  if (l<0)
752  {
753  for (i=w->rows()-1;i>=0;i--)
754  {
755  if ((*w)[i]<0) l0--;
756  }
757  if (l0==0)
758  {
759  for (i=w->rows()-1;i>=0;i--)
760  {
761  if ((*w)[i]>0) l0++;
762  }
763  }
764  return l0;
765  }
766  else
767  {
768  for (i=w->rows()-1;i>=0;i--)
769  {
770  if ((*w)[i]<0) return -1;
771  }
772  for (i=w->rows()-1;i>=0;i--)
773  {
774  if ((*w)[i]>0) l0++;
775  }
776  return l0;
777  }
778 }
int rows() const
Definition: intvec.h:88
int i
Definition: cfEzgcd.cc:123
int l
Definition: cfEzgcd.cc:94

§ ivContent()

static void ivContent ( intvec w)
static

Definition at line 780 of file intvec.cc.

781 {
782  int tgcd, m;
783  int i=w->rows()-1;
784 
785  loop
786  {
787  tgcd = (*w)[i--];
788  if (tgcd!=0) break;
789  if (i<0) return;
790  }
791  if (tgcd<0) tgcd = -tgcd;
792  if (tgcd==1) return;
793  loop
794  {
795  m = (*w)[i--];
796  if (m!=0) tgcd= ivGcd(tgcd, m);
797  if (tgcd==1) return;
798  if (i<0) break;
799  }
800  for (i=w->rows()-1;i>=0;i--)
801  (*w)[i] /= tgcd;
802 }
loop
Definition: myNF.cc:98
static int ivGcd(int, int)
Definition: intvec.cc:631
int rows() const
Definition: intvec.h:88
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123

§ ivFreeRow()

static void ivFreeRow ( intvec imat,
int  rowpos,
int  rpiv 
)
static

Definition at line 505 of file intvec.cc.

506 {
507  int i, j;
508 
509  for (j=rpiv-1;j>=rowpos;j--)
510  {
511  for (i=imat->cols();i!=0;i--)
512  IMATELEM(*imat,j+1,i) = IMATELEM(*imat,j,i);
513  }
514 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivGcd()

static int ivGcd ( int  a,
int  b 
)
static

Definition at line 631 of file intvec.cc.

632 {
633  int x;
634 
635  if (a<0) a=-a;
636  if (b<0) b=-b;
637  if (b>a)
638  {
639  x=b;
640  b=a;
641  a=x;
642  }
643  while (b!=0)
644  {
645  x = a % b;
646  a = b;
647  b = x;
648  }
649  return a;
650 }
const poly a
Definition: syzextra.cc:212
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213

§ ivKernFromRow()

static void ivKernFromRow ( intvec kern,
intvec imat,
intvec perm,
int  pos,
int  r,
int  c 
)
static

Definition at line 596 of file intvec.cc.

598 {
599  int piv, cp, g, i, j, k, s;
600 
601  for (i=c;i>(*perm)[r];i--)
602  {
603  IMATELEM(*kern,pos,i) = 1;
604  for (j=r;j!=0;j--)
605  {
606  cp = (*perm)[j];
607  s=0;
608  for(k=c;k>cp;k--)
609  s += IMATELEM(*imat,j,k)*IMATELEM(*kern,pos,k);
610  if (s!=0)
611  {
612  piv = IMATELEM(*imat,j,cp);
613  g = ivGcd(piv,s);
614  if (g!=1)
615  {
616  s /= g;
617  piv /= g;
618  }
619  for(k=c;k>cp;k--)
620  IMATELEM(*kern,pos,k) *= piv;
621  IMATELEM(*kern,pos,cp) = -s;
622  ivRowContent(kern,pos,cp);
623  }
624  }
625  if (IMATELEM(*kern,pos,i)<0)
626  ivNegRow(kern,pos);
627  pos--;
628  }
629 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void ivNegRow(intvec *, int)
Definition: intvec.cc:481
static int ivGcd(int, int)
Definition: intvec.cc:631
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:572
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivL1Norm()

static int ivL1Norm ( intvec w)
static

Definition at line 732 of file intvec.cc.

733 {
734  int i, j, s = 0;
735 
736  for (i=w->rows()-1;i>=0;i--)
737  {
738  j = (*w)[i];
739  if (j>0)
740  s += j;
741  else
742  s -= j;
743  }
744  return s;
745 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int rows() const
Definition: intvec.h:88
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123

§ ivMult()

intvec* ivMult ( intvec a,
intvec b 
)

Definition at line 332 of file intvec.cc.

333 {
334  int i, j, k, sum,
335  ra = a->rows(), ca = a->cols(),
336  rb = b->rows(), cb = b->cols();
337  intvec * iv;
338  if (ca != rb) return NULL;
339  iv = new intvec(ra, cb, 0);
340  for (i=0; i<ra; i++)
341  {
342  for (j=0; j<cb; j++)
343  {
344  sum = 0;
345  for (k=0; k<ca; k++)
346  sum += (*a)[i*ca+k]*(*b)[k*cb+j];
347  (*iv)[i*cb+j] = sum;
348  }
349  }
350  return iv;
351 }
int rows() const
Definition: intvec.h:88
int k
Definition: cfEzgcd.cc:93
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87

§ ivNegRow()

static void ivNegRow ( intvec imat,
int  rpiv 
)
static

Definition at line 481 of file intvec.cc.

482 {
483  int i;
484  for (i=imat->cols();i!=0;i--)
485  IMATELEM(*imat,rpiv,i) = -(IMATELEM(*imat,rpiv,i));
486 }
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivOptimizeKern()

static intvec * ivOptimizeKern ( intvec kern)
static

Definition at line 652 of file intvec.cc.

653 {
654  int i,l,j,c=kern->cols(),r=kern->rows();
655  intvec *res=new intvec(c);
656 
657  if (TEST_OPT_PROT)
658  Warn(" %d linear independent solutions\n",r);
659  for (i=r;i>1;i--)
660  {
661  for (j=c;j>0;j--)
662  {
663  (*res)[j-1] += IMATELEM(*kern,i,j);
664  }
665  }
666  ivContent(res);
667  if (r<11)
668  {
669  l = ivCondNumber(res,-c);
670  j = ivL1Norm(res);
671  ivOptRecursive(res, NULL, kern, l, j, r);
672  }
673  return res;
674 }
#define TEST_OPT_PROT
Definition: options.h:98
static int ivL1Norm(intvec *)
Definition: intvec.cc:732
int rows() const
Definition: intvec.h:88
static void ivContent(intvec *)
Definition: intvec.cc:780
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static void ivOptRecursive(intvec *, intvec *, intvec *, int &, int &, int)
Definition: intvec.cc:676
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:747
#define IMATELEM(M, I, J)
Definition: intvec.h:77
int l
Definition: cfEzgcd.cc:94
#define Warn
Definition: emacs.cc:80

§ ivOptRecursive()

static void ivOptRecursive ( intvec res,
intvec w,
intvec kern,
int &  l,
int &  j,
int  pos 
)
static

Definition at line 676 of file intvec.cc.

678 {
679  int m, k, d;
680  intvec *h;
681 
682  d=kern->rows();
683  d=96/(d*d);
684  if (d<3) d=3;
685  if (w!=0)
686  h = new intvec(w);
687  else
688  h = new intvec(res->rows());
689  for (m=d;m>0;m--)
690  {
691  for(k=h->rows()-1;k>=0;k--)
692  (*h)[k] += IMATELEM(*kern,pos,k+1);
693  if(pos>1)
694  ivOptRecursive(res, h, kern, l, j, pos-1);
695  else
696  ivOptSolve(res, h, l, j);
697  }
698  delete h;
699  if (pos>1)
700  ivOptRecursive(res, w, kern, l, j, pos-1);
701  else if (w!=NULL)
702  ivOptSolve(res, w, l, j);
703 }
int rows() const
Definition: intvec.h:88
int k
Definition: cfEzgcd.cc:93
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static void ivOptRecursive(intvec *, intvec *, intvec *, int &, int &, int)
Definition: intvec.cc:676
#define NULL
Definition: omList.c:10
static void ivOptSolve(intvec *, intvec *, int &, int &)
Definition: intvec.cc:705
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:77
int l
Definition: cfEzgcd.cc:94

§ ivOptSolve()

static void ivOptSolve ( intvec res,
intvec w,
int &  l,
int &  j 
)
static

Definition at line 705 of file intvec.cc.

706 {
707  int l0, j0, k;
708 
709  l0 = ivCondNumber(w, l);
710  if (l0==l)
711  {
712  ivContent(w);
713  j0 = ivL1Norm(w);
714  if(j0<j)
715  {
716  j = j0;
717  for(k=w->rows()-1;k>=0;k--)
718  (*res)[k] = (*w)[k];
719  }
720  return;
721  }
722  if(l0>l)
723  {
724  l = l0;
725  ivContent(w);
726  j = ivL1Norm(w);
727  for(k=w->rows()-1;k>=0;k--)
728  (*res)[k] = (*w)[k];
729  }
730 }
static int ivL1Norm(intvec *)
Definition: intvec.cc:732
int rows() const
Definition: intvec.h:88
int k
Definition: cfEzgcd.cc:93
static void ivContent(intvec *)
Definition: intvec.cc:780
int j
Definition: myNF.cc:70
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:747
int l
Definition: cfEzgcd.cc:94

§ ivReduce()

static void ivReduce ( intvec imat,
int  rpiv,
int  colpos,
int  ready,
int  all 
)
static

Definition at line 516 of file intvec.cc.

518 {
519  int tgcd, ce, m1, m2, j, i;
520  int piv = IMATELEM(*imat,rpiv,colpos);
521 
522  for (j=all;j>ready;j--)
523  {
524  ivRowContent(imat, j, 1);
525  ce = IMATELEM(*imat,j,colpos);
526  if (ce!=0)
527  {
528  IMATELEM(*imat,j,colpos) = 0;
529  m1 = piv;
530  m2 = ce;
531  tgcd = ivGcd(m1, m2);
532  if (tgcd != 1)
533  {
534  m1 /= tgcd;
535  m2 /= tgcd;
536  }
537  for (i=imat->cols();i>colpos;i--)
538  {
539  IMATELEM(*imat,j,i) = IMATELEM(*imat,j,i)*m1-
540  IMATELEM(*imat,rpiv,i)*m2;
541  }
542  ivRowContent(imat, j, colpos+1);
543  }
544  }
545 }
static int ivGcd(int, int)
Definition: intvec.cc:631
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:572
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivRowContent()

static void ivRowContent ( intvec imat,
int  rowpos,
int  colpos 
)
static

Definition at line 572 of file intvec.cc.

573 {
574  int tgcd, m;
575  int i=imat->cols();
576 
577  loop
578  {
579  tgcd = IMATELEM(*imat,rowpos,i--);
580  if (tgcd!=0) break;
581  if (i<colpos) return;
582  }
583  if (tgcd<0) tgcd = -tgcd;
584  if (tgcd==1) return;
585  loop
586  {
587  m = IMATELEM(*imat,rowpos,i--);
588  if (m!=0) tgcd= ivGcd(tgcd, m);
589  if (tgcd==1) return;
590  if (i<colpos) break;
591  }
592  for (i=imat->cols();i>=colpos;i--)
593  IMATELEM(*imat,rowpos,i) /= tgcd;
594 }
loop
Definition: myNF.cc:98
static int ivGcd(int, int)
Definition: intvec.cc:631
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivSaveRow()

static void ivSaveRow ( intvec imat,
int  rpiv 
)
static

Definition at line 488 of file intvec.cc.

489 {
490  int i, j=imat->rows();
491 
492  for (i=imat->cols();i!=0;i--)
493  IMATELEM(*imat,j,i) = IMATELEM(*imat,rpiv,i);
494 }
int rows() const
Definition: intvec.h:88
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivSetRow()

static void ivSetRow ( intvec imat,
int  rowpos,
int  colpos 
)
static

Definition at line 496 of file intvec.cc.

497 {
498  int i, j=imat->rows();
499 
500  for (i=imat->cols();i!=0;i--)
501  IMATELEM(*imat,rowpos,i) = IMATELEM(*imat,j,i);
502  ivRowContent(imat, rowpos, colpos);
503 }
int rows() const
Definition: intvec.h:88
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:572
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivSolveKern()

intvec* ivSolveKern ( intvec imat,
int  dimtr 
)

Definition at line 425 of file intvec.cc.

426 {
427  int d=imat->cols();
428  int kdim=d-dimtr;
429  intvec *perm = new intvec(dimtr+1);
430  intvec *kern = new intvec(kdim,d,0);
431  intvec *res;
432  int c, cp, r, t;
433 
434  t = kdim;
435  c = 1;
436  for (r=1;r<=dimtr;r++)
437  {
438  while (IMATELEM(*imat,r,c)==0) c++;
439  (*perm)[r] = c;
440  c++;
441  }
442  c = d;
443  for (r=dimtr;r>0;r--)
444  {
445  cp = (*perm)[r];
446  if (cp!=c)
447  {
448  ivKernFromRow(kern, imat, perm, t, r, c);
449  t -= (c-cp);
450  if (t==0)
451  break;
452  c = cp-1;
453  }
454  else
455  c--;
456  }
457  if (kdim>1)
458  res = ivOptimizeKern(kern);
459  else
460  res = ivTranp(kern);
461  delete kern;
462  delete perm;
463  return res;
464 }
static intvec * ivOptimizeKern(intvec *)
Definition: intvec.cc:652
intvec * ivTranp(intvec *o)
Definition: intvec.cc:310
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
static void ivKernFromRow(intvec *, intvec *, intvec *, int, int, int)
Definition: intvec.cc:596
int cols() const
Definition: intvec.h:87
int perm[100]
#define IMATELEM(M, I, J)
Definition: intvec.h:77

§ ivSub()

intvec* ivSub ( intvec a,
intvec b 
)

Definition at line 280 of file intvec.cc.

281 {
282  intvec * iv;
283  int mn, ma, i;
284  if (a->cols() != b->cols()) return NULL;
285  mn = si_min(a->rows(),b->rows());
286  ma = si_max(a->rows(),b->rows());
287  if (a->cols() == 1)
288  {
289  iv = new intvec(ma);
290  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
291  if (ma > mn)
292  {
293  if (ma == a->rows())
294  {
295  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
296  }
297  else
298  {
299  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
300  }
301  }
302  return iv;
303  }
304  if (mn != ma) return NULL;
305  iv = new intvec(a);
306  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
307  return iv;
308 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:124
int rows() const
Definition: intvec.h:88
Definition: intvec.h:14
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87

§ ivTrace()

int ivTrace ( intvec o)

Definition at line 322 of file intvec.cc.

323 {
324  int i, s = 0, m = si_min(o->rows(),o->cols()), c = o->cols();
325  for (i=0; i<m; i++)
326  {
327  s += (*o)[i*c+i];
328  }
329  return s;
330 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static int si_min(const int a, const int b)
Definition: auxiliary.h:124
int rows() const
Definition: intvec.h:88
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87

§ ivTranp()

intvec* ivTranp ( intvec o)

Definition at line 310 of file intvec.cc.

311 {
312  int i, j, r = o->rows(), c = o->cols();
313  intvec * iv= new intvec(c, r, 0);
314  for (i=0; i<r; i++)
315  {
316  for (j=0; j<c; j++)
317  (*iv)[j*r+i] = (*o)[i*c+j];
318  }
319  return iv;
320 }
int rows() const
Definition: intvec.h:88
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87

§ ivTriangIntern()

void ivTriangIntern ( intvec imat,
int &  ready,
int &  all 
)

Definition at line 387 of file intvec.cc.

388 {
389  int rpiv, colpos=0, rowpos=0;
390  int ia=ready, ie=all;
391 
392  do
393  {
394  rowpos++;
395  do
396  {
397  colpos++;
398  rpiv = ivColPivot(imat, colpos, rowpos, ia, ie);
399  } while (rpiv==0);
400  if (rpiv>ia)
401  {
402  if (rowpos!=rpiv)
403  {
404  ivSaveRow(imat, rpiv);
405  ivFreeRow(imat, rowpos, rpiv);
406  ivSetRow(imat, rowpos, colpos);
407  rpiv = rowpos;
408  }
409  ia++;
410  if (ia==imat->cols())
411  {
412  ready = ia;
413  all = ie;
414  return;
415  }
416  }
417  ivReduce(imat, rpiv, colpos, ia, ie);
418  ivZeroElim(imat, colpos, ia, ie);
419  } while (ie>ia);
420  ready = ia;
421  all = ie;
422 }
static void ivZeroElim(intvec *, int, int, int &)
Definition: intvec.cc:547
static void ivFreeRow(intvec *, int, int)
Definition: intvec.cc:505
static void ivSaveRow(intvec *, int)
Definition: intvec.cc:488
static int ivColPivot(intvec *, int, int, int, int)
Definition: intvec.cc:467
static void ivReduce(intvec *, int, int, int, int)
Definition: intvec.cc:516
static void ivSetRow(intvec *, int, int)
Definition: intvec.cc:496
int cols() const
Definition: intvec.h:87

§ ivZeroElim()

static void ivZeroElim ( intvec imat,
int  colpos,
int  ready,
int &  all 
)
static

Definition at line 547 of file intvec.cc.

549 {
550  int j, i, k, l;
551 
552  k = ready;
553  for (j=ready+1;j<=all;j++)
554  {
555  for (i=imat->cols();i>colpos;i--)
556  {
557  if (IMATELEM(*imat,j,i)!=0)
558  {
559  k++;
560  if (k<j)
561  {
562  for (l=imat->cols();l>colpos;l--)
563  IMATELEM(*imat,k,l) = IMATELEM(*imat,j,l);
564  }
565  break;
566  }
567  }
568  }
569  all = k;
570 }
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77
int l
Definition: cfEzgcd.cc:94