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 276 of file intvec.cc.

277 {
278  intvec * iv;
279  int mn, ma, i;
280  if (a->cols() != b->cols()) return NULL;
281  mn = si_min(a->rows(),b->rows());
282  ma = si_max(a->rows(),b->rows());
283  if (a->cols() == 1)
284  {
285  iv = new intvec(ma);
286  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] + (*b)[i];
287  if (ma > mn)
288  {
289  if (ma == a->rows())
290  {
291  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
292  }
293  else
294  {
295  for(i=mn; i<ma; i++) (*iv)[i] = (*b)[i];
296  }
297  }
298  return iv;
299  }
300  if (mn != ma) return NULL;
301  iv = new intvec(a);
302  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] += (*b)[i]; }
303  return iv;
304 }
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:87
int rows() const
Definition: intvec.h:88
static int ivColPivot ( intvec imat,
int  colpos,
int  rowpos,
int  ready,
int  all 
)
static

Definition at line 493 of file intvec.cc.

494 {
495  int rpiv;
496 
497  if (IMATELEM(*imat,rowpos,colpos)!=0)
498  return rowpos;
499  for (rpiv=ready+1;rpiv<=all;rpiv++)
500  {
501  if (IMATELEM(*imat,rpiv,colpos)!=0)
502  return rpiv;
503  }
504  return 0;
505 }
#define IMATELEM(M, I, J)
Definition: intvec.h:77
intvec* ivConcat ( intvec a,
intvec b 
)

Definition at line 831 of file intvec.cc.

832 {
833  int ac=a->cols();
834  int c = ac + b->cols(); int r = si_max(a->rows(),b->rows());
835  intvec * ab = new intvec(r,c,0);
836 
837  int i,j;
838  for (i=1; i<=a->rows(); i++)
839  {
840  for(j=1; j<=ac; j++)
841  IMATELEM(*ab,i,j) = IMATELEM(*a,i,j);
842  }
843  for (i=1; i<=b->rows(); i++)
844  {
845  for(j=1; j<=b->cols(); j++)
846  IMATELEM(*ab,i,j+ac) = IMATELEM(*b,i,j);
847  }
848  return ab;
849 }
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:87
int rows() const
Definition: intvec.h:88
#define IMATELEM(M, I, J)
Definition: intvec.h:77
static int ivCondNumber ( intvec w,
int  l 
)
static

Definition at line 773 of file intvec.cc.

774 {
775  int l0=0, i;
776 
777  if (l<0)
778  {
779  for (i=w->rows()-1;i>=0;i--)
780  {
781  if ((*w)[i]<0) l0--;
782  }
783  if (l0==0)
784  {
785  for (i=w->rows()-1;i>=0;i--)
786  {
787  if ((*w)[i]>0) l0++;
788  }
789  }
790  return l0;
791  }
792  else
793  {
794  for (i=w->rows()-1;i>=0;i--)
795  {
796  if ((*w)[i]<0) return -1;
797  }
798  for (i=w->rows()-1;i>=0;i--)
799  {
800  if ((*w)[i]>0) l0++;
801  }
802  return l0;
803  }
804 }
int i
Definition: cfEzgcd.cc:123
int rows() const
Definition: intvec.h:88
int l
Definition: cfEzgcd.cc:94
static void ivContent ( intvec w)
static

Definition at line 806 of file intvec.cc.

807 {
808  int tgcd, m;
809  int i=w->rows()-1;
810 
811  loop
812  {
813  tgcd = (*w)[i--];
814  if (tgcd!=0) break;
815  if (i<0) return;
816  }
817  if (tgcd<0) tgcd = -tgcd;
818  if (tgcd==1) return;
819  loop
820  {
821  m = (*w)[i--];
822  if (m!=0) tgcd= ivGcd(tgcd, m);
823  if (tgcd==1) return;
824  if (i<0) break;
825  }
826  for (i=w->rows()-1;i>=0;i--)
827  (*w)[i] /= tgcd;
828 }
loop
Definition: myNF.cc:98
static int ivGcd(int, int)
Definition: intvec.cc:657
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
int rows() const
Definition: intvec.h:88
static void ivFreeRow ( intvec imat,
int  rowpos,
int  rpiv 
)
static

Definition at line 531 of file intvec.cc.

532 {
533  int i, j;
534 
535  for (j=rpiv-1;j>=rowpos;j--)
536  {
537  for (i=imat->cols();i!=0;i--)
538  IMATELEM(*imat,j+1,i) = IMATELEM(*imat,j,i);
539  }
540 }
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
static int ivGcd ( int  a,
int  b 
)
static

Definition at line 657 of file intvec.cc.

658 {
659  int x;
660 
661  if (a<0) a=-a;
662  if (b<0) b=-b;
663  if (b>a)
664  {
665  x=b;
666  b=a;
667  a=x;
668  }
669  while (b!=0)
670  {
671  x = a % b;
672  a = b;
673  b = x;
674  }
675  return a;
676 }
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 622 of file intvec.cc.

624 {
625  int piv, cp, g, i, j, k, s;
626 
627  for (i=c;i>(*perm)[r];i--)
628  {
629  IMATELEM(*kern,pos,i) = 1;
630  for (j=r;j!=0;j--)
631  {
632  cp = (*perm)[j];
633  s=0;
634  for(k=c;k>cp;k--)
635  s += IMATELEM(*imat,j,k)*IMATELEM(*kern,pos,k);
636  if (s!=0)
637  {
638  piv = IMATELEM(*imat,j,cp);
639  g = ivGcd(piv,s);
640  if (g!=1)
641  {
642  s /= g;
643  piv /= g;
644  }
645  for(k=c;k>cp;k--)
646  IMATELEM(*kern,pos,k) *= piv;
647  IMATELEM(*kern,pos,cp) = -s;
648  ivRowContent(kern,pos,cp);
649  }
650  }
651  if (IMATELEM(*kern,pos,i)<0)
652  ivNegRow(kern,pos);
653  pos--;
654  }
655 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void ivNegRow(intvec *, int)
Definition: intvec.cc:507
static int ivGcd(int, int)
Definition: intvec.cc:657
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:598
#define IMATELEM(M, I, J)
Definition: intvec.h:77
static int ivL1Norm ( intvec w)
static

Definition at line 758 of file intvec.cc.

759 {
760  int i, j, s = 0;
761 
762  for (i=w->rows()-1;i>=0;i--)
763  {
764  j = (*w)[i];
765  if (j>0)
766  s += j;
767  else
768  s -= j;
769  }
770  return s;
771 }
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:88
intvec* ivMult ( intvec a,
intvec b 
)

Definition at line 358 of file intvec.cc.

359 {
360  int i, j, k, sum,
361  ra = a->rows(), ca = a->cols(),
362  rb = b->rows(), cb = b->cols();
363  intvec * iv;
364  if (ca != rb) return NULL;
365  iv = new intvec(ra, cb, 0);
366  for (i=0; i<ra; i++)
367  {
368  for (j=0; j<cb; j++)
369  {
370  sum = 0;
371  for (k=0; k<ca; k++)
372  sum += (*a)[i*ca+k]*(*b)[k*cb+j];
373  (*iv)[i*cb+j] = sum;
374  }
375  }
376  return iv;
377 }
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:87
int rows() const
Definition: intvec.h:88
static void ivNegRow ( intvec imat,
int  rpiv 
)
static

Definition at line 507 of file intvec.cc.

508 {
509  int i;
510  for (i=imat->cols();i!=0;i--)
511  IMATELEM(*imat,rpiv,i) = -(IMATELEM(*imat,rpiv,i));
512 }
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
#define IMATELEM(M, I, J)
Definition: intvec.h:77
static intvec * ivOptimizeKern ( intvec kern)
static

Definition at line 678 of file intvec.cc.

679 {
680  int i,l,j,c=kern->cols(),r=kern->rows();
681  intvec *res=new intvec(c);
682 
683  if (TEST_OPT_PROT)
684  Warn(" %d linear independent solutions\n",r);
685  for (i=r;i>1;i--)
686  {
687  for (j=c;j>0;j--)
688  {
689  (*res)[j-1] += IMATELEM(*kern,i,j);
690  }
691  }
692  ivContent(res);
693  if (r<11)
694  {
695  l = ivCondNumber(res,-c);
696  j = ivL1Norm(res);
697  ivOptRecursive(res, NULL, kern, l, j, r);
698  }
699  return res;
700 }
#define TEST_OPT_PROT
Definition: options.h:98
static int ivL1Norm(intvec *)
Definition: intvec.cc:758
static void ivContent(intvec *)
Definition: intvec.cc:806
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:702
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:773
#define IMATELEM(M, I, J)
Definition: intvec.h:77
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 702 of file intvec.cc.

704 {
705  int m, k, d;
706  intvec *h;
707 
708  d=kern->rows();
709  d=96/(d*d);
710  if (d<3) d=3;
711  if (w!=0)
712  h = new intvec(w);
713  else
714  h = new intvec(res->rows());
715  for (m=d;m>0;m--)
716  {
717  for(k=h->rows()-1;k>=0;k--)
718  (*h)[k] += IMATELEM(*kern,pos,k+1);
719  if(pos>1)
720  ivOptRecursive(res, h, kern, l, j, pos-1);
721  else
722  ivOptSolve(res, h, l, j);
723  }
724  delete h;
725  if (pos>1)
726  ivOptRecursive(res, w, kern, l, j, pos-1);
727  else if (w!=NULL)
728  ivOptSolve(res, w, l, j);
729 }
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:702
#define NULL
Definition: omList.c:10
int rows() const
Definition: intvec.h:88
static void ivOptSolve(intvec *, intvec *, int &, int &)
Definition: intvec.cc:731
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:77
int l
Definition: cfEzgcd.cc:94
static void ivOptSolve ( intvec res,
intvec w,
int &  l,
int &  j 
)
static

Definition at line 731 of file intvec.cc.

732 {
733  int l0, j0, k;
734 
735  l0 = ivCondNumber(w, l);
736  if (l0==l)
737  {
738  ivContent(w);
739  j0 = ivL1Norm(w);
740  if(j0<j)
741  {
742  j = j0;
743  for(k=w->rows()-1;k>=0;k--)
744  (*res)[k] = (*w)[k];
745  }
746  return;
747  }
748  if(l0>l)
749  {
750  l = l0;
751  ivContent(w);
752  j = ivL1Norm(w);
753  for(k=w->rows()-1;k>=0;k--)
754  (*res)[k] = (*w)[k];
755  }
756 }
static int ivL1Norm(intvec *)
Definition: intvec.cc:758
int k
Definition: cfEzgcd.cc:93
static void ivContent(intvec *)
Definition: intvec.cc:806
int j
Definition: myNF.cc:70
int rows() const
Definition: intvec.h:88
static int ivCondNumber(intvec *, int)
Definition: intvec.cc:773
int l
Definition: cfEzgcd.cc:94
static void ivReduce ( intvec imat,
int  rpiv,
int  colpos,
int  ready,
int  all 
)
static

Definition at line 542 of file intvec.cc.

544 {
545  int tgcd, ce, m1, m2, j, i;
546  int piv = IMATELEM(*imat,rpiv,colpos);
547 
548  for (j=all;j>ready;j--)
549  {
550  ivRowContent(imat, j, 1);
551  ce = IMATELEM(*imat,j,colpos);
552  if (ce!=0)
553  {
554  IMATELEM(*imat,j,colpos) = 0;
555  m1 = piv;
556  m2 = ce;
557  tgcd = ivGcd(m1, m2);
558  if (tgcd != 1)
559  {
560  m1 /= tgcd;
561  m2 /= tgcd;
562  }
563  for (i=imat->cols();i>colpos;i--)
564  {
565  IMATELEM(*imat,j,i) = IMATELEM(*imat,j,i)*m1-
566  IMATELEM(*imat,rpiv,i)*m2;
567  }
568  ivRowContent(imat, j, colpos+1);
569  }
570  }
571 }
static int ivGcd(int, int)
Definition: intvec.cc:657
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:598
#define IMATELEM(M, I, J)
Definition: intvec.h:77
static void ivRowContent ( intvec imat,
int  rowpos,
int  colpos 
)
static

Definition at line 598 of file intvec.cc.

599 {
600  int tgcd, m;
601  int i=imat->cols();
602 
603  loop
604  {
605  tgcd = IMATELEM(*imat,rowpos,i--);
606  if (tgcd!=0) break;
607  if (i<colpos) return;
608  }
609  if (tgcd<0) tgcd = -tgcd;
610  if (tgcd==1) return;
611  loop
612  {
613  m = IMATELEM(*imat,rowpos,i--);
614  if (m!=0) tgcd= ivGcd(tgcd, m);
615  if (tgcd==1) return;
616  if (i<colpos) break;
617  }
618  for (i=imat->cols();i>=colpos;i--)
619  IMATELEM(*imat,rowpos,i) /= tgcd;
620 }
loop
Definition: myNF.cc:98
static int ivGcd(int, int)
Definition: intvec.cc:657
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
static void ivSaveRow ( intvec imat,
int  rpiv 
)
static

Definition at line 514 of file intvec.cc.

515 {
516  int i, j=imat->rows();
517 
518  for (i=imat->cols();i!=0;i--)
519  IMATELEM(*imat,j,i) = IMATELEM(*imat,rpiv,i);
520 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
#define IMATELEM(M, I, J)
Definition: intvec.h:77
static void ivSetRow ( intvec imat,
int  rowpos,
int  colpos 
)
static

Definition at line 522 of file intvec.cc.

523 {
524  int i, j=imat->rows();
525 
526  for (i=imat->cols();i!=0;i--)
527  IMATELEM(*imat,rowpos,i) = IMATELEM(*imat,j,i);
528  ivRowContent(imat, rowpos, colpos);
529 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
static void ivRowContent(intvec *, int, int)
Definition: intvec.cc:598
#define IMATELEM(M, I, J)
Definition: intvec.h:77
intvec* ivSolveKern ( intvec imat,
int  dimtr 
)

Definition at line 451 of file intvec.cc.

452 {
453  int d=imat->cols();
454  int kdim=d-dimtr;
455  intvec *perm = new intvec(dimtr+1);
456  intvec *kern = new intvec(kdim,d,0);
457  intvec *res;
458  int c, cp, r, t;
459 
460  t = kdim;
461  c = 1;
462  for (r=1;r<=dimtr;r++)
463  {
464  while (IMATELEM(*imat,r,c)==0) c++;
465  (*perm)[r] = c;
466  c++;
467  }
468  c = d;
469  for (r=dimtr;r>0;r--)
470  {
471  cp = (*perm)[r];
472  if (cp!=c)
473  {
474  ivKernFromRow(kern, imat, perm, t, r, c);
475  t -= (c-cp);
476  if (t==0)
477  break;
478  c = cp-1;
479  }
480  else
481  c--;
482  }
483  if (kdim>1)
484  res = ivOptimizeKern(kern);
485  else
486  res = ivTranp(kern);
487  delete kern;
488  delete perm;
489  return res;
490 }
static intvec * ivOptimizeKern(intvec *)
Definition: intvec.cc:678
intvec * ivTranp(intvec *o)
Definition: intvec.cc:336
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int cols() const
Definition: intvec.h:87
static void ivKernFromRow(intvec *, intvec *, intvec *, int, int, int)
Definition: intvec.cc:622
int perm[100]
#define IMATELEM(M, I, J)
Definition: intvec.h:77
intvec* ivSub ( intvec a,
intvec b 
)

Definition at line 306 of file intvec.cc.

307 {
308  intvec * iv;
309  int mn, ma, i;
310  if (a->cols() != b->cols()) return NULL;
311  mn = si_min(a->rows(),b->rows());
312  ma = si_max(a->rows(),b->rows());
313  if (a->cols() == 1)
314  {
315  iv = new intvec(ma);
316  for (i=0; i<mn; i++) (*iv)[i] = (*a)[i] - (*b)[i];
317  if (ma > mn)
318  {
319  if (ma == a->rows())
320  {
321  for(i=mn; i<ma; i++) (*iv)[i] = (*a)[i];
322  }
323  else
324  {
325  for(i=mn; i<ma; i++) (*iv)[i] = -(*b)[i];
326  }
327  }
328  return iv;
329  }
330  if (mn != ma) return NULL;
331  iv = new intvec(a);
332  for (i=0; i<mn*a->cols(); i++) { (*iv)[i] -= (*b)[i]; }
333  return iv;
334 }
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:87
int rows() const
Definition: intvec.h:88
int ivTrace ( intvec o)

Definition at line 348 of file intvec.cc.

349 {
350  int i, s = 0, m = si_min(o->rows(),o->cols()), c = o->cols();
351  for (i=0; i<m; i++)
352  {
353  s += (*o)[i*c+i];
354  }
355  return s;
356 }
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:87
int rows() const
Definition: intvec.h:88
intvec* ivTranp ( intvec o)

Definition at line 336 of file intvec.cc.

337 {
338  int i, j, r = o->rows(), c = o->cols();
339  intvec * iv= new intvec(c, r, 0);
340  for (i=0; i<r; i++)
341  {
342  for (j=0; j<c; j++)
343  (*iv)[j*r+i] = (*o)[i*c+j];
344  }
345  return iv;
346 }
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:87
int rows() const
Definition: intvec.h:88
void ivTriangIntern ( intvec imat,
int &  ready,
int &  all 
)

Definition at line 413 of file intvec.cc.

414 {
415  int rpiv, colpos=0, rowpos=0;
416  int ia=ready, ie=all;
417 
418  do
419  {
420  rowpos++;
421  do
422  {
423  colpos++;
424  rpiv = ivColPivot(imat, colpos, rowpos, ia, ie);
425  } while (rpiv==0);
426  if (rpiv>ia)
427  {
428  if (rowpos!=rpiv)
429  {
430  ivSaveRow(imat, rpiv);
431  ivFreeRow(imat, rowpos, rpiv);
432  ivSetRow(imat, rowpos, colpos);
433  rpiv = rowpos;
434  }
435  ia++;
436  if (ia==imat->cols())
437  {
438  ready = ia;
439  all = ie;
440  return;
441  }
442  }
443  ivReduce(imat, rpiv, colpos, ia, ie);
444  ivZeroElim(imat, colpos, ia, ie);
445  } while (ie>ia);
446  ready = ia;
447  all = ie;
448 }
static void ivZeroElim(intvec *, int, int, int &)
Definition: intvec.cc:573
static void ivFreeRow(intvec *, int, int)
Definition: intvec.cc:531
static void ivSaveRow(intvec *, int)
Definition: intvec.cc:514
static int ivColPivot(intvec *, int, int, int, int)
Definition: intvec.cc:493
static void ivReduce(intvec *, int, int, int, int)
Definition: intvec.cc:542
static void ivSetRow(intvec *, int, int)
Definition: intvec.cc:522
int cols() const
Definition: intvec.h:87
static void ivZeroElim ( intvec imat,
int  colpos,
int  ready,
int &  all 
)
static

Definition at line 573 of file intvec.cc.

575 {
576  int j, i, k, l;
577 
578  k = ready;
579  for (j=ready+1;j<=all;j++)
580  {
581  for (i=imat->cols();i>colpos;i--)
582  {
583  if (IMATELEM(*imat,j,i)!=0)
584  {
585  k++;
586  if (k<j)
587  {
588  for (l=imat->cols();l>colpos;l--)
589  IMATELEM(*imat,k,l) = IMATELEM(*imat,j,l);
590  }
591  break;
592  }
593  }
594  }
595  all = k;
596 }
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