Public Member Functions | Private Attributes
newtonPolygon Class Reference

#include <npolygon.h>

Public Member Functions

 newtonPolygon ()
 
 newtonPolygon (const newtonPolygon &)
 
 newtonPolygon (poly, const ring r)
 
 ~newtonPolygon ()
 
newtonPolygonoperator= (const newtonPolygon &)
 
void copy_new (int)
 
void copy_delete (void)
 
void copy_zero (void)
 
void copy_shallow (newtonPolygon &)
 
void copy_deep (const newtonPolygon &)
 
void add_linearForm (const linearForm &)
 
Rational weight (poly, const ring r) const
 
Rational weight_shift (poly, const ring r) const
 
Rational weight1 (poly, const ring r) const
 
Rational weight_shift1 (poly, const ring r) const
 

Private Attributes

linearForml
 
int N
 

Detailed Description

Definition at line 61 of file npolygon.h.

Constructor & Destructor Documentation

newtonPolygon::newtonPolygon ( )
inline

Definition at line 165 of file npolygon.h.

166 {
167  copy_zero( );
168 }
void copy_zero(void)
Definition: npolygon.h:144
newtonPolygon::newtonPolygon ( const newtonPolygon np)

Definition at line 368 of file npolygon.cc.

369 {
370  copy_deep( np );
371 }
void copy_deep(const newtonPolygon &)
Definition: npolygon.cc:354
newtonPolygon::newtonPolygon ( poly  f,
const ring  r 
)

Definition at line 398 of file npolygon.cc.

399 {
400  copy_zero( );
401 
402  int *r=new int[s->N];
403  poly *m=new poly[s->N];
404 
405 
406  KMatrix<Rational> mat(s->N,s->N+1 );
407 
408  int i,j,stop=FALSE;
409  linearForm sol;
410 
411  // ---------------
412  // init counters
413  // ---------------
414 
415  for( i=0; i<s->N; i++ )
416  {
417  r[i] = i;
418  }
419 
420  m[0] = f;
421 
422  for( i=1; i<s->N; i++ )
423  {
424  m[i] = pNext(m[i-1]);
425  }
426 
427  // -----------------------------
428  // find faces (= linear forms)
429  // -----------------------------
430 
431  do
432  {
433  // ---------------------------------------------------
434  // test if monomials p.m[r[0]]m,...,p.m[r[p.vars-1]]
435  // are linearely independent
436  // ---------------------------------------------------
437 
438  for( i=0; i<s->N; i++ )
439  {
440  for( j=0; j<s->N; j++ )
441  {
442  // mat.set( i,j,pGetExp( m[r[i]],j+1 ) );
443  mat.set( i,j,p_GetExp( m[i],j+1,s ) );
444  }
445  mat.set( i,j,1 );
446  }
447 
448  if( mat.solve( &(sol.c),&(sol.N) ) == s->N )
449  {
450  // ---------------------------------
451  // check if linearForm is positive
452  // check if linearForm is extremal
453  // ---------------------------------
454 
455  if( sol.positive( ) && sol.pweight( f,s ) >= (Rational)1 )
456  {
457  // ----------------------------------
458  // this is a face or the polyhedron
459  // ----------------------------------
460 
461  add_linearForm( sol );
462  sol.c = (Rational*)NULL;
463  sol.N = 0;
464  }
465  }
466 
467  // --------------------
468  // increment counters
469  // --------------------
470 
471  for( i=1; r[i-1] + 1 == r[i] && i < s->N; i++ );
472 
473  for( j=0; j<i-1; j++ )
474  {
475  r[j]=j;
476  }
477 
478  if( i>1 )
479  {
480  m[0]=f;
481  for( j=1; j<i-1; j++ )
482  {
483  m[j]=pNext(m[j-1]);
484  }
485  }
486  r[i-1]++;
487  m[i-1]=pNext(m[i-1]);
488 
489  if( m[s->N-1] == (poly)NULL )
490  {
491  stop = TRUE;
492  }
493  } while( stop == FALSE );
494 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
f
Definition: cfModGcd.cc:4022
int positive(void)
Definition: npolygon.cc:280
#define TRUE
Definition: auxiliary.h:144
Rational * c
Definition: npolygon.h:22
Rational pweight(poly, const ring r) const
Definition: npolygon.cc:206
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
void add_linearForm(const linearForm &)
Definition: npolygon.cc:526
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
void copy_zero(void)
Definition: npolygon.h:144
newtonPolygon::~newtonPolygon ( )

Definition at line 377 of file npolygon.cc.

378 {
379  copy_delete( );
380 }
void copy_delete(void)
Definition: npolygon.cc:343

Member Function Documentation

void newtonPolygon::add_linearForm ( const linearForm l0)

Definition at line 526 of file npolygon.cc.

527 {
528  int i;
529  newtonPolygon np;
530 
531  // -------------------------------------
532  // test if linear form is already here
533  // -------------------------------------
534 
535  for( i=0; i<N; i++ )
536  {
537  if( l0==l[i] )
538  {
539  return;
540  }
541  }
542 
543  np.copy_new( N+1 );
544  np.N = N+1;
545 
546  for( i=0; i<N; i++ )
547  {
548  np.l[i].copy_shallow( l[i] );
549  l[i].copy_zero( );
550  }
551 
552  np.l[N] = l0;
553 
554  copy_delete( );
555  copy_shallow( np );
556  np.copy_zero( );
557 
558  return;
559 }
void copy_zero(void)
Definition: npolygon.h:109
void copy_shallow(linearForm &)
Definition: npolygon.h:119
void copy_new(int)
Definition: npolygon.cc:297
void copy_delete(void)
Definition: npolygon.cc:343
void copy_shallow(newtonPolygon &)
Definition: npolygon.h:154
int i
Definition: cfEzgcd.cc:123
linearForm * l
Definition: npolygon.h:66
void copy_zero(void)
Definition: npolygon.h:144
void newtonPolygon::copy_deep ( const newtonPolygon np)

Definition at line 354 of file npolygon.cc.

355 {
356  copy_new( np.N );
357  for( int i=0; i<np.N; i++ )
358  {
359  l[i] = np.l[i];
360  }
361  N = np.N;
362 }
void copy_new(int)
Definition: npolygon.cc:297
int i
Definition: cfEzgcd.cc:123
linearForm * l
Definition: npolygon.h:66
void newtonPolygon::copy_delete ( void  )

Definition at line 343 of file npolygon.cc.

344 {
345  if( l != (linearForm*)NULL && N > 0 )
346  delete [] l;
347  copy_zero( );
348 }
#define NULL
Definition: omList.c:10
linearForm * l
Definition: npolygon.h:66
void copy_zero(void)
Definition: npolygon.h:144
void newtonPolygon::copy_new ( int  k)

Definition at line 297 of file npolygon.cc.

298 {
299  if( k > 0 )
300  {
301  l = new linearForm[k];
302 
303  #ifndef SING_NDEBUG
304  if( l == (linearForm*)NULL )
305  {
306  #ifdef NPOLYGON_PRINT
307  #ifdef NPOLYGON_IOSTREAM
308  cerr <<
309  "void newtonPolygon::copy_new( int k ): no memory left ...\n";
310  #else
311  fprintf( stderr,
312  "void newtonPolygon::copy_new( int k ): no memory left ...\n" );
313  #endif
314  #endif
315 
316  HALT();
317  }
318  #endif
319  }
320  else if( k == 0 )
321  {
322  l = (linearForm*)NULL;
323  }
324  else if( k < 0 )
325  {
326  #ifdef NPOLYGON_PRINT
327  #ifdef NPOLYGON_IOSTREAM
328  cerr << "void newtonPolygon::copy_new( int k ): k < 0 ...\n";
329  #else
330  fprintf( stderr,
331  "void newtonPolygon::copy_new( int k ): k < 0 ...\n" );
332  #endif
333  #endif
334 
335  HALT();
336  }
337 }
int k
Definition: cfEzgcd.cc:93
#define HALT()
Definition: mod2.h:128
#define NULL
Definition: omList.c:10
linearForm * l
Definition: npolygon.h:66
void newtonPolygon::copy_shallow ( newtonPolygon np)
inline

Definition at line 154 of file npolygon.h.

155 {
156  l = np.l;
157  N = np.N;
158 }
linearForm * l
Definition: npolygon.h:66
void newtonPolygon::copy_zero ( void  )
inline

Definition at line 144 of file npolygon.h.

145 {
146  l = (linearForm*)NULL;
147  N = 0;
148 }
#define NULL
Definition: omList.c:10
linearForm * l
Definition: npolygon.h:66
newtonPolygon & newtonPolygon::operator= ( const newtonPolygon np)

Definition at line 386 of file npolygon.cc.

387 {
388  copy_delete( );
389  copy_deep( np );
390 
391  return *this;
392 }
void copy_deep(const newtonPolygon &)
Definition: npolygon.cc:354
void copy_delete(void)
Definition: npolygon.cc:343
Rational newtonPolygon::weight ( poly  m,
const ring  r 
) const

Definition at line 565 of file npolygon.cc.

566 {
567  Rational ret = l[0].weight( m,r );
568  Rational tmp;
569 
570  for( int i=1; i<N; i++ )
571  {
572  tmp = l[i].weight( m,r );
573 
574  if( tmp < ret )
575  {
576  ret = tmp;
577  }
578  }
579  return ret;
580 }
Rational weight(poly, const ring r) const
Definition: npolygon.cc:190
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
linearForm * l
Definition: npolygon.h:66
Rational newtonPolygon::weight1 ( poly  m,
const ring  r 
) const

Definition at line 607 of file npolygon.cc.

608 {
609  Rational ret = l[0].weight1( m, r );
610  Rational tmp;
611 
612  for( int i=1; i<N; i++ )
613  {
614  tmp = l[i].weight1( m, r );
615 
616  if( tmp < ret )
617  {
618  ret = tmp;
619  }
620  }
621  return ret;
622 }
Rational weight1(poly, const ring r) const
Definition: npolygon.cc:246
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
linearForm * l
Definition: npolygon.h:66
Rational newtonPolygon::weight_shift ( poly  m,
const ring  r 
) const

Definition at line 586 of file npolygon.cc.

587 {
588  Rational ret = l[0].weight_shift( m, r );
589  Rational tmp;
590 
591  for( int i=1; i<N; i++ )
592  {
593  tmp = l[i].weight_shift( m, r );
594 
595  if( tmp < ret )
596  {
597  ret = tmp;
598  }
599  }
600  return ret;
601 }
Rational weight_shift(poly, const ring r) const
Definition: npolygon.cc:230
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
linearForm * l
Definition: npolygon.h:66
Rational newtonPolygon::weight_shift1 ( poly  m,
const ring  r 
) const

Definition at line 629 of file npolygon.cc.

630 {
631  Rational ret = l[0].weight_shift1( m, r );
632  Rational tmp;
633 
634  for( int i=1; i<N; i++ )
635  {
636  tmp = l[i].weight_shift1( m, r );
637 
638  if( tmp < ret )
639  {
640  ret = tmp;
641  }
642  }
643  return ret;
644 }
Rational weight_shift1(poly, const ring r) const
Definition: npolygon.cc:263
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
linearForm * l
Definition: npolygon.h:66

Field Documentation

linearForm* newtonPolygon::l
private

Definition at line 66 of file npolygon.h.

int newtonPolygon::N
private

Definition at line 67 of file npolygon.h.


The documentation for this class was generated from the following files: