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

#define INTVEC_CC

Definition at line 8 of file intvec.cc.

Function Documentation

intvec* ivAdd ( intvec a,
intvec b 
)

Definition at line 262 of file intvec.cc.

263 {
264  intvec * iv;
265  int mn, ma, i;
266  if (a->cols() != b->cols()) return NULL;
267  mn = si_min(a->rows(),b->rows());
268  ma = si_max(a->rows(),b->rows());
269  if (a->cols() == 1)
270  {
271  iv = new intvec(ma);
272  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
273  if (ma > mn)
274  {
275  if (ma == a->rows())
276  {
277  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
278  }
279  else
280  {
281  for(i=mn; i<ma; i++) (*iv)[i] = (*b)[i];
282  }
283  }
284  return iv;
285  }
286  if (mn != ma) return NULL;
287  iv = new intvec(a);
288  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
289  return iv;
290 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
Definition: intvec.h:16
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
static int ivColPivot ( intvec imat,
int  colpos,
int  rowpos,
int  ready,
int  all 
)
static

Definition at line 479 of file intvec.cc.

480 {
481  int rpiv;
482 
483  if (IMATELEM(*imat,rowpos,colpos)!=0)
484  return rowpos;
485  for (rpiv=ready+1;rpiv<=all;rpiv++)
486  {
487  if (IMATELEM(*imat,rpiv,colpos)!=0)
488  return rpiv;
489  }
490  return 0;
491 }
#define IMATELEM(M, I, J)
Definition: intvec.h:76
intvec* ivConcat ( intvec a,
intvec b 
)

Definition at line 817 of file intvec.cc.

818 {
819  int ac=a->cols();
820  int c = ac + b->cols(); int r = si_max(a->rows(),b->rows());
821  intvec * ab = new intvec(r,c,0);
822 
823  int i,j;
824  for (i=1; i<=a->rows(); i++)
825  {
826  for(j=1; j<=ac; j++)
827  IMATELEM(*ab,i,j) = IMATELEM(*a,i,j);
828  }
829  for (i=1; i<=b->rows(); i++)
830  {
831  for(j=1; j<=b->cols(); j++)
832  IMATELEM(*ab,i,j+ac) = IMATELEM(*b,i,j);
833  }
834  return ab;
835 }
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int j
Definition: myNF.cc:70
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static int ivCondNumber ( intvec w,
int  l 
)
static

Definition at line 759 of file intvec.cc.

760 {
761  int l0=0, i;
762 
763  if (l<0)
764  {
765  for (i=w->rows()-1;i>=0;i--)
766  {
767  if ((*w)[i]<0) l0--;
768  }
769  if (l0==0)
770  {
771  for (i=w->rows()-1;i>=0;i--)
772  {
773  if ((*w)[i]>0) l0++;
774  }
775  }
776  return l0;
777  }
778  else
779  {
780  for (i=w->rows()-1;i>=0;i--)
781  {
782  if ((*w)[i]<0) return -1;
783  }
784  for (i=w->rows()-1;i>=0;i--)
785  {
786  if ((*w)[i]>0) l0++;
787  }
788  return l0;
789  }
790 }
int i
Definition: cfEzgcd.cc:123
int rows() const
Definition: intvec.h:87
int l
Definition: cfEzgcd.cc:94
static void ivContent ( intvec w)
static

Definition at line 792 of file intvec.cc.

793 {
794  int tgcd, m;
795  int i=w->rows()-1;
796 
797  loop
798  {
799  tgcd = (*w)[i--];
800  if (tgcd!=0) break;
801  if (i<0) return;
802  }
803  if (tgcd<0) tgcd = -tgcd;
804  if (tgcd==1) return;
805  loop
806  {
807  m = (*w)[i--];
808  if (m!=0) tgcd= ivGcd(tgcd, m);
809  if (tgcd==1) return;
810  if (i<0) break;
811  }
812  for (i=w->rows()-1;i>=0;i--)
813  (*w)[i] /= tgcd;
814 }
loop
Definition: myNF.cc:98
static int ivGcd(int, int)
Definition: intvec.cc:643
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int rows() const
Definition: intvec.h:87
static void ivFreeRow ( intvec imat,
int  rowpos,
int  rpiv 
)
static

Definition at line 517 of file intvec.cc.

518 {
519  int i, j;
520 
521  for (j=rpiv-1;j>=rowpos;j--)
522  {
523  for (i=imat->cols();i!=0;i--)
524  IMATELEM(*imat,j+1,i) = IMATELEM(*imat,j,i);
525  }
526 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static int ivGcd ( int  a,
int  b 
)
static

Definition at line 643 of file intvec.cc.

644 {
645  int x;
646 
647  if (a<0) a=-a;
648  if (b<0) b=-b;
649  if (b>a)
650  {
651  x=b;
652  b=a;
653  a=x;
654  }
655  while (b!=0)
656  {
657  x = a % b;
658  a = b;
659  b = x;
660  }
661  return a;
662 }
const poly a
Definition: syzextra.cc:212
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213
static void ivKernFromRow ( intvec kern,
intvec imat,
intvec perm,
int  pos,
int  r,
int  c 
)
static

Definition at line 608 of file intvec.cc.

610 {
611  int piv, cp, g, i, j, k, s;
612 
613  for (i=c;i>(*perm)[r];i--)
614  {
615  IMATELEM(*kern,pos,i) = 1;
616  for (j=r;j!=0;j--)
617  {
618  cp = (*perm)[j];
619  s=0;
620  for(k=c;k>cp;k--)
621  s += IMATELEM(*imat,j,k)*IMATELEM(*kern,pos,k);
622  if (s!=0)
623  {
624  piv = IMATELEM(*imat,j,cp);
625  g = ivGcd(piv,s);
626  if (g!=1)
627  {
628  s /= g;
629  piv /= g;
630  }
631  for(k=c;k>cp;k--)
632  IMATELEM(*kern,pos,k) *= piv;
633  IMATELEM(*kern,pos,cp) = -s;
634  ivRowContent(kern,pos,cp);
635  }
636  }
637  if (IMATELEM(*kern,pos,i)<0)
638  ivNegRow(kern,pos);
639  pos--;
640  }
641 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void ivNegRow(intvec *, int)
Definition: intvec.cc:493
static int ivGcd(int, int)
Definition: intvec.cc:643
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:584
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static int ivL1Norm ( intvec w)
static

Definition at line 744 of file intvec.cc.

745 {
746  int i, j, s = 0;
747 
748  for (i=w->rows()-1;i>=0;i--)
749  {
750  j = (*w)[i];
751  if (j>0)
752  s += j;
753  else
754  s -= j;
755  }
756  return s;
757 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int rows() const
Definition: intvec.h:87
intvec* ivMult ( intvec a,
intvec b 
)

Definition at line 344 of file intvec.cc.

345 {
346  int i, j, k, sum,
347  ra = a->rows(), ca = a->cols(),
348  rb = b->rows(), cb = b->cols();
349  intvec * iv;
350  if (ca != rb) return NULL;
351  iv = new intvec(ra, cb, 0);
352  for (i=0; i<ra; i++)
353  {
354  for (j=0; j<cb; j++)
355  {
356  sum = 0;
357  for (k=0; k<ca; k++)
358  sum += (*a)[i*ca+k]*(*b)[k*cb+j];
359  (*iv)[i*cb+j] = sum;
360  }
361  }
362  return iv;
363 }
int k
Definition: cfEzgcd.cc:93
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
static void ivNegRow ( intvec imat,
int  rpiv 
)
static

Definition at line 493 of file intvec.cc.

494 {
495  int i;
496  for (i=imat->cols();i!=0;i--)
497  IMATELEM(*imat,rpiv,i) = -(IMATELEM(*imat,rpiv,i));
498 }
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static intvec * ivOptimizeKern ( intvec kern)
static

Definition at line 664 of file intvec.cc.

665 {
666  int i,l,j,c=kern->cols(),r=kern->rows();
667  intvec *res=new intvec(c);
668 
669  if (TEST_OPT_PROT)
670  Warn(" %d linear independent solutions\n",r);
671  for (i=r;i>1;i--)
672  {
673  for (j=c;j>0;j--)
674  {
675  (*res)[j-1] += IMATELEM(*kern,i,j);
676  }
677  }
678  ivContent(res);
679  if (r<11)
680  {
681  l = ivCondNumber(res,-c);
682  j = ivL1Norm(res);
683  ivOptRecursive(res, NULL, kern, l, j, r);
684  }
685  return res;
686 }
#define TEST_OPT_PROT
Definition: options.h:98
static int ivL1Norm(intvec *)
Definition: intvec.cc:744
static void ivContent(intvec *)
Definition: intvec.cc:792
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
static void ivOptRecursive(intvec *, intvec *, intvec *, int &, int &, int)
Definition: intvec.cc:688
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:759
#define IMATELEM(M, I, J)
Definition: intvec.h:76
int l
Definition: cfEzgcd.cc:94
#define Warn
Definition: emacs.cc:80
static void ivOptRecursive ( intvec res,
intvec w,
intvec kern,
int l,
int j,
int  pos 
)
static

Definition at line 688 of file intvec.cc.

690 {
691  int m, k, d;
692  intvec *h;
693 
694  d=kern->rows();
695  d=96/(d*d);
696  if (d<3) d=3;
697  if (w!=0)
698  h = new intvec(w);
699  else
700  h = new intvec(res->rows());
701  for (m=d;m>0;m--)
702  {
703  for(k=h->rows()-1;k>=0;k--)
704  (*h)[k] += IMATELEM(*kern,pos,k+1);
705  if(pos>1)
706  ivOptRecursive(res, h, kern, l, j, pos-1);
707  else
708  ivOptSolve(res, h, l, j);
709  }
710  delete h;
711  if (pos>1)
712  ivOptRecursive(res, w, kern, l, j, pos-1);
713  else if (w!=NULL)
714  ivOptSolve(res, w, l, j);
715 }
int k
Definition: cfEzgcd.cc:93
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static void ivOptRecursive(intvec *, intvec *, intvec *, int &, int &, int)
Definition: intvec.cc:688
#define NULL
Definition: omList.c:10
int rows() const
Definition: intvec.h:87
static void ivOptSolve(intvec *, intvec *, int &, int &)
Definition: intvec.cc:717
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:76
int l
Definition: cfEzgcd.cc:94
static void ivOptSolve ( intvec res,
intvec w,
int l,
int j 
)
static

Definition at line 717 of file intvec.cc.

718 {
719  int l0, j0, k;
720 
721  l0 = ivCondNumber(w, l);
722  if (l0==l)
723  {
724  ivContent(w);
725  j0 = ivL1Norm(w);
726  if(j0<j)
727  {
728  j = j0;
729  for(k=w->rows()-1;k>=0;k--)
730  (*res)[k] = (*w)[k];
731  }
732  return;
733  }
734  if(l0>l)
735  {
736  l = l0;
737  ivContent(w);
738  j = ivL1Norm(w);
739  for(k=w->rows()-1;k>=0;k--)
740  (*res)[k] = (*w)[k];
741  }
742 }
static int ivL1Norm(intvec *)
Definition: intvec.cc:744
int k
Definition: cfEzgcd.cc:93
static void ivContent(intvec *)
Definition: intvec.cc:792
int j
Definition: myNF.cc:70
int rows() const
Definition: intvec.h:87
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:759
int l
Definition: cfEzgcd.cc:94
static void ivReduce ( intvec imat,
int  rpiv,
int  colpos,
int  ready,
int  all 
)
static

Definition at line 528 of file intvec.cc.

530 {
531  int tgcd, ce, m1, m2, j, i;
532  int piv = IMATELEM(*imat,rpiv,colpos);
533 
534  for (j=all;j>ready;j--)
535  {
536  ivRowContent(imat, j, 1);
537  ce = IMATELEM(*imat,j,colpos);
538  if (ce!=0)
539  {
540  IMATELEM(*imat,j,colpos) = 0;
541  m1 = piv;
542  m2 = ce;
543  tgcd = ivGcd(m1, m2);
544  if (tgcd != 1)
545  {
546  m1 /= tgcd;
547  m2 /= tgcd;
548  }
549  for (i=imat->cols();i>colpos;i--)
550  {
551  IMATELEM(*imat,j,i) = IMATELEM(*imat,j,i)*m1-
552  IMATELEM(*imat,rpiv,i)*m2;
553  }
554  ivRowContent(imat, j, colpos+1);
555  }
556  }
557 }
static int ivGcd(int, int)
Definition: intvec.cc:643
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:584
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static void ivRowContent ( intvec imat,
int  rowpos,
int  colpos 
)
static

Definition at line 584 of file intvec.cc.

585 {
586  int tgcd, m;
587  int i=imat->cols();
588 
589  loop
590  {
591  tgcd = IMATELEM(*imat,rowpos,i--);
592  if (tgcd!=0) break;
593  if (i<colpos) return;
594  }
595  if (tgcd<0) tgcd = -tgcd;
596  if (tgcd==1) return;
597  loop
598  {
599  m = IMATELEM(*imat,rowpos,i--);
600  if (m!=0) tgcd= ivGcd(tgcd, m);
601  if (tgcd==1) return;
602  if (i<colpos) break;
603  }
604  for (i=imat->cols();i>=colpos;i--)
605  IMATELEM(*imat,rowpos,i) /= tgcd;
606 }
loop
Definition: myNF.cc:98
static int ivGcd(int, int)
Definition: intvec.cc:643
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static void ivSaveRow ( intvec imat,
int  rpiv 
)
static

Definition at line 500 of file intvec.cc.

501 {
502  int i, j=imat->rows();
503 
504  for (i=imat->cols();i!=0;i--)
505  IMATELEM(*imat,j,i) = IMATELEM(*imat,rpiv,i);
506 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:76
static void ivSetRow ( intvec imat,
int  rowpos,
int  colpos 
)
static

Definition at line 508 of file intvec.cc.

509 {
510  int i, j=imat->rows();
511 
512  for (i=imat->cols();i!=0;i--)
513  IMATELEM(*imat,rowpos,i) = IMATELEM(*imat,j,i);
514  ivRowContent(imat, rowpos, colpos);
515 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:584
#define IMATELEM(M, I, J)
Definition: intvec.h:76
intvec* ivSolveKern ( intvec imat,
int  dimtr 
)

Definition at line 437 of file intvec.cc.

438 {
439  int d=imat->cols();
440  int kdim=d-dimtr;
441  intvec *perm = new intvec(dimtr+1);
442  intvec *kern = new intvec(kdim,d,0);
443  intvec *res;
444  int c, cp, r, t;
445 
446  t = kdim;
447  c = 1;
448  for (r=1;r<=dimtr;r++)
449  {
450  while (IMATELEM(*imat,r,c)==0) c++;
451  (*perm)[r] = c;
452  c++;
453  }
454  c = d;
455  for (r=dimtr;r>0;r--)
456  {
457  cp = (*perm)[r];
458  if (cp!=c)
459  {
460  ivKernFromRow(kern, imat, perm, t, r, c);
461  t -= (c-cp);
462  if (t==0)
463  break;
464  c = cp-1;
465  }
466  else
467  c--;
468  }
469  if (kdim>1)
470  res = ivOptimizeKern(kern);
471  else
472  res = ivTranp(kern);
473  delete kern;
474  delete perm;
475  return res;
476 }
static intvec * ivOptimizeKern(intvec *)
Definition: intvec.cc:664
intvec * ivTranp(intvec *o)
Definition: intvec.cc:322
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int cols() const
Definition: intvec.h:86
static void ivKernFromRow(intvec *, intvec *, intvec *, int, int, int)
Definition: intvec.cc:608
#define IMATELEM(M, I, J)
Definition: intvec.h:76
intvec* ivSub ( intvec a,
intvec b 
)

Definition at line 292 of file intvec.cc.

293 {
294  intvec * iv;
295  int mn, ma, i;
296  if (a->cols() != b->cols()) return NULL;
297  mn = si_min(a->rows(),b->rows());
298  ma = si_max(a->rows(),b->rows());
299  if (a->cols() == 1)
300  {
301  iv = new intvec(ma);
302  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
303  if (ma > mn)
304  {
305  if (ma == a->rows())
306  {
307  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
308  }
309  else
310  {
311  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
312  }
313  }
314  return iv;
315  }
316  if (mn != ma) return NULL;
317  iv = new intvec(a);
318  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
319  return iv;
320 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
Definition: intvec.h:16
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
int ivTrace ( intvec o)

Definition at line 334 of file intvec.cc.

335 {
336  int i, s = 0, m = si_min(o->rows(),o->cols()), c = o->cols();
337  for (i=0; i<m; i++)
338  {
339  s += (*o)[i*c+i];
340  }
341  return s;
342 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
intvec* ivTranp ( intvec o)

Definition at line 322 of file intvec.cc.

323 {
324  int i, j, r = o->rows(), c = o->cols();
325  intvec * iv= new intvec(c, r, 0);
326  for (i=0; i<r; i++)
327  {
328  for (j=0; j<c; j++)
329  (*iv)[j*r+i] = (*o)[i*c+j];
330  }
331  return iv;
332 }
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
int rows() const
Definition: intvec.h:87
void ivTriangIntern ( intvec imat,
int ready,
int all 
)

Definition at line 399 of file intvec.cc.

400 {
401  int rpiv, colpos=0, rowpos=0;
402  int ia=ready, ie=all;
403 
404  do
405  {
406  rowpos++;
407  do
408  {
409  colpos++;
410  rpiv = ivColPivot(imat, colpos, rowpos, ia, ie);
411  } while (rpiv==0);
412  if (rpiv>ia)
413  {
414  if (rowpos!=rpiv)
415  {
416  ivSaveRow(imat, rpiv);
417  ivFreeRow(imat, rowpos, rpiv);
418  ivSetRow(imat, rowpos, colpos);
419  rpiv = rowpos;
420  }
421  ia++;
422  if (ia==imat->cols())
423  {
424  ready = ia;
425  all = ie;
426  return;
427  }
428  }
429  ivReduce(imat, rpiv, colpos, ia, ie);
430  ivZeroElim(imat, colpos, ia, ie);
431  } while (ie>ia);
432  ready = ia;
433  all = ie;
434 }
static void ivZeroElim(intvec *, int, int, int &)
Definition: intvec.cc:559
static void ivFreeRow(intvec *, int, int)
Definition: intvec.cc:517
static void ivSaveRow(intvec *, int)
Definition: intvec.cc:500
static int ivColPivot(intvec *, int, int, int, int)
Definition: intvec.cc:479
static void ivReduce(intvec *, int, int, int, int)
Definition: intvec.cc:528
static void ivSetRow(intvec *, int, int)
Definition: intvec.cc:508
int cols() const
Definition: intvec.h:86
static void ivZeroElim ( intvec imat,
int  colpos,
int  ready,
int all 
)
static

Definition at line 559 of file intvec.cc.

561 {
562  int j, i, k, l;
563 
564  k = ready;
565  for (j=ready+1;j<=all;j++)
566  {
567  for (i=imat->cols();i>colpos;i--)
568  {
569  if (IMATELEM(*imat,j,i)!=0)
570  {
571  k++;
572  if (k<j)
573  {
574  for (l=imat->cols();l>colpos;l--)
575  IMATELEM(*imat,k,l) = IMATELEM(*imat,j,l);
576  }
577  break;
578  }
579  }
580  }
581  all = k;
582 }
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:86
#define IMATELEM(M, I, J)
Definition: intvec.h:76
int l
Definition: cfEzgcd.cc:94