Changeset 08e15e7 in git


Ignore:
Timestamp:
Sep 6, 2011, 7:40:16 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
Children:
213d649793d02bccc46292a68beead7b202af509
Parents:
b9cf410a96c73af3a43f5d317b0ff37eec0a49de
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-09-06 19:40:16+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:12:32+01:00
Message:
FIX: numeric/mpr_*
Location:
numeric
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • numeric/mpr_base.cc

    rb9cf41 r08e15e7  
    99 */
    1010
    11 #include <math.h>
    12 
     11//-> includes
    1312#include <kernel/mod2.h>
    1413
     14#include <misc/auxiliary.h>
     15#include <omalloc/omalloc.h>
     16
    1517#include <misc/mylimits.h>
    16 #include <omalloc/omalloc.h>
    17 
    18 //-> includes
    19 #include <kernel/options.h>
     18#include <misc/options.h>
     19#include <misc/intvec.h>
     20
     21#include <coeffs/numbers.h>
     22#include <coeffs/mpr_global.h>
     23
     24#include <polys/matpol.h>
     25#include <polys/sparsmat.h>
     26
     27#ifdef HAVE_FACTORY
     28#include <polys/clapsing.h>
     29#endif
     30
     31#include <kernel/febase.h>
    2032#include <kernel/polys.h>
    2133#include <kernel/ideals.h>
    22 #include <kernel/febase.h>
    23 #include <kernel/intvec.h>
    24 #include <kernel/matpol.h>
    25 #include <kernel/numbers.h>
    26 #ifdef HAVE_FACTORY
    27 #include <kernel/clapsing.h>
    28 #endif
    29 #include <kernel/sparsmat.h>
    30 
    31 #include <kernel/mpr_global.h>
    32 #include <kernel/mpr_base.h>
    33 #include <kernel/mpr_numeric.h>
     34
     35#include "mpr_base.h"
     36#include "mpr_numeric.h"
     37
     38#include <math.h>
    3439//<-
    3540
     
    278283{
    279284public:
    280   mayanPyramidAlg( simplex * _pLP ) : n(pVariables), pLP(_pLP) {}
     285  mayanPyramidAlg( simplex * _pLP ) : n((currRing->N)), pLP(_pLP) {}
    281286  ~mayanPyramidAlg() {}
    282287
     
    380385      && (!nIsZero(pGetCoeff( MATELEM( omat, i, j)))))
    381386      {
    382         val= n_Int(pGetCoeff( MATELEM( omat, i, j) ), currRing);
     387        val= n_Int(pGetCoeff( MATELEM( omat, i, j) ), currRing->cf);
    383388        if ( i==MATROWS(omat) && j==MATCOLS(omat) )
    384389        {
     
    781786  int * vert;
    782787
    783   n= pVariables;
     788  n= (currRing->N);
    784789  vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
    785790
    786791  Q = (pointSet **)omAlloc( idelem * sizeof(pointSet*) );        // support hulls
    787792  for ( i= 0; i < idelem; i++ )
    788     Q[i] = new pointSet( pVariables, i+1, pLength((gls->m)[i])+1 );
     793    Q[i] = new pointSet( (currRing->N), i+1, pLength((gls->m)[i])+1 );
    789794
    790795  for( i= 0; i < idelem; i++ )
     
    820825    for ( j=1; j <= Q[i]->num; j++ )
    821826    {
    822       Print("%d: <",j);print_exp( (*Q[i])[j] , pVariables );PrintS(">\n");
     827      Print("%d: <",j);print_exp( (*Q[i])[j] , (currRing->N) );PrintS(">\n");
    823828    }
    824829    PrintLn();
     
    841846  int * vert;
    842847
    843   n= pVariables;
     848  n= (currRing->N);
    844849  vert= (int *)omAlloc( (idelem+1) * sizeof(int) );
    845850  id= idInit( idelem, 1 );
     
    12181223bool resMatrixSparse::remapXiToPoint( const int indx, pointSet **pQ, int *set, int *pnt )
    12191224{
    1220   int i,nn= pVariables;
     1225  int i,nn= (currRing->N);
    12211226  int loffset= 0;
    12221227  for ( i= 0; i <= nn; i++ )
     
    14211426
    14221427  epp_mon= (int *)omAlloc( (n+2) * sizeof(int) );
    1423   eexp= (int *)omAlloc0((pVariables+1)*sizeof(int));
     1428  eexp= (int *)omAlloc0(((currRing->N)+1)*sizeof(int));
    14241429
    14251430  totDeg= numSet0;
     
    14801485  pDelete( &epp );
    14811486  omFreeSize( (void *) epp_mon, (n+2) * sizeof(int) );
    1482   omFreeSize( (void *) eexp, (pVariables+1)*sizeof(int));
     1487  omFreeSize( (void *) eexp, ((currRing->N)+1)*sizeof(int));
    14831488
    14841489#ifdef mprDEBUG_ALL
     
    15251530  int j,k,l;
    15261531
    1527   vert.point=(Coord_t*)omAlloc( (pVariables+2) * sizeof(Coord_t) );
     1532  vert.point=(Coord_t*)omAlloc( ((currRing->N)+2) * sizeof(Coord_t) );
    15281533
    15291534  vs= new pointSet( dim );
     
    15421547  }
    15431548
    1544   omFreeSize( (void *) vert.point, (pVariables+2) * sizeof(Coord_t) );
     1549  omFreeSize( (void *) vert.point, ((currRing->N)+2) * sizeof(Coord_t) );
    15451550
    15461551  return vs;
     
    15791584  mprfloat shift[MAXVARS+2];   // shiftvector delta, index [1..dim]
    15801585
    1581   if ( pVariables > MAXVARS )
     1586  if ( (currRing->N) > MAXVARS )
    15821587  {
    15831588    WerrorS("resMatrixSparse::resMatrixSparse: Too many variables!");
     
    15931598  istate= resMatrixBase::ready;
    15941599
    1595   n= pVariables;
     1600  n= (currRing->N);
    15961601  idelem= IDELEMS(gls);  // should be n+1
    15971602
     
    19741979
    19751980  /** Recursively generate all homogeneous monoms of
    1976    * pVariables variables of degree deg.
     1981   * (currRing->N) variables of degree deg.
    19771982   */
    19781983  void generateMonoms( poly m, int var, int deg );
     
    20292034
    20302035  /** holds the index of u0, u1, ..., un, if (elementOfS == linPolyS)
    2031    *  the size is given by pVariables
     2036   *  the size is given by (currRing->N)
    20322037   */
    20332038  int *numColParNr;
     
    21002105                numVectors * sizeof( number ) );
    21012106    omfreeSize( (void *)resVectorList[i].numColParNr,
    2102                 (pVariables+1) * sizeof(int) );
     2107                ((currRing->N)+1) * sizeof(int) );
    21032108  }
    21042109
     
    21352140    {
    21362141      mprSTICKYPROT(ST_DENSE_FR);
    2137       for ( i= 0; i < pVariables; i++ )
     2142      for ( i= 0; i < (currRing->N); i++ )
    21382143      {
    21392144        MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i])= pInit();
     
    21612166    if ( linPolyS == getMVector(k)->elementOfS )
    21622167    {
    2163       for ( i=0; i < pVariables; i++ )
     2168      for ( i=0; i < (currRing->N); i++ )
    21642169      {
    21652170        Print(" %d ",(getMVector(k)->numColParNr)[i]);
     
    22072212  else
    22082213  {
    2209     if ( var == pVariables+1 ) return;
     2214    if ( var == (currRing->N)+1 ) return;
    22102215    poly newm = pCopy( mm );
    22112216    while ( deg >= 0 )
     
    23522357  // the internal Variable Ordering
    23532358  // make sure that the homogenization variable goes last!
    2354   intvec iVO( pVariables );
     2359  intvec iVO( (currRing->N) );
    23552360  if ( linPolyS != SNONE )
    23562361  {
    2357     iVO[pVariables - 1]= linPolyS;
     2362    iVO[(currRing->N) - 1]= linPolyS;
    23582363    int p=0;
    2359     for ( k= pVariables - 1; k >= 0; k-- )
     2364    for ( k= (currRing->N) - 1; k >= 0; k-- )
    23602365    {
    23612366      if ( k != linPolyS )
     
    23692374  {
    23702375    linPolyS= 0;
    2371     for ( k= 0; k < pVariables; k++ )
    2372       iVO[k]= pVariables - k - 1;
     2376    for ( k= 0; k < (currRing->N); k++ )
     2377      iVO[k]= (currRing->N) - k - 1;
    23732378  }
    23742379
     
    24252430      resVectorList[k].numColVectorSize= 0;
    24262431      resVectorList[k].numColVector= NULL;
    2427       resVectorList[k].numColParNr= (int *)omAlloc0( (pVariables+1) * sizeof(int) );
     2432      resVectorList[k].numColParNr= (int *)omAlloc0( ((currRing->N)+1) * sizeof(int) );
    24282433
    24292434      pi= (gls->m)[ resVectorList[k].elementOfS ];
     
    24892494    if ( resVectorList[i].elementOfS == linPolyS )
    24902495    {
    2491       for (j=1; j <= pVariables; j++ )
     2496      for (j=1; j <= (currRing->N); j++ )
    24922497      {
    24932498        if ( MATELEM(resmat,numVectors-i,
     
    24982503        if ( FALSE )
    24992504        {
    2500           pSetCoeff( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), nPar(j) );
     2505          pSetCoeff( MATELEM(resmat,numVectors-i,numVectors-resVectorList[i].numColParNr[j-1]), n_Param(j,currRing) );
    25012506        }
    25022507        else
     
    25552560    if ( linPolyS == getMVector(k)->elementOfS )
    25562561    {
    2557       for ( i= 0; i < pVariables; i++ )
     2562      for ( i= 0; i < (currRing->N); i++ )
    25582563      {
    25592564        pSetCoeff( MATELEM(m,numVectors-k,numVectors-(getMVector(k)->numColParNr)[i]),
     
    25672572  // evaluate determinant of matrix m using factory singclap_det
    25682573#ifdef HAVE_FACTORY
    2569   poly res= singclap_det( m );
     2574  poly res= singclap_det( m, currRing );
    25702575#else
    25712576  poly res= NULL;
     
    26312636
    26322637#ifdef HAVE_FACTORY
    2633   poly res= singclap_det( mat );
     2638  poly res= singclap_det( mat, currRing );
    26342639#else
    26352640  poly res= NULL;
     
    27532758  poly actlp, rootlp= newlp;
    27542759
    2755   for ( i= 1; i <= pVariables; i++ )
     2760  for ( i= 1; i <= (currRing->N); i++ )
    27562761  {
    27572762    actlp= newlp;
     
    32013206  ideal idr;
    32023207
    3203   n= pVariables;
     3208  n= (currRing->N);
    32043209  idelem= IDELEMS(id);  // should be n+1
    32053210
  • numeric/mpr_inout.cc

    rb9cf41 r08e15e7  
    1010
    1111#include <kernel/mod2.h>
     12
    1213//#ifdef HAVE_MPR
    1314
    1415//-> includes
     16#include <misc/auxiliary.h>
     17#include <omalloc/omalloc.h>
     18
     19#include <misc/mylimits.h>
     20#include <misc/options.h>
     21#include <misc/intvec.h>
     22
     23#include <coeffs/numbers.h>
     24#include <coeffs/mpr_global.h>
     25
     26#include <polys/matpol.h>
     27
     28
     29#include <kernel/febase.h>
    1530#include <kernel/structs.h>
    1631#include <kernel/polys.h>
    1732#include <kernel/ideals.h>
    18 #include <kernel/ring.h>
    19 #include <kernel/febase.h>
    20 #include <omalloc/omalloc.h>
    21 #include <kernel/numbers.h>
    22 #include <kernel/matpol.h>
     33
    2334
    2435#include <math.h>
    2536
    26 #include <kernel/mpr_global.h>
    27 #include <kernel/mpr_inout.h>
    28 #include <kernel/mpr_base.h>
    29 #include <kernel/mpr_numeric.h>
     37#include "mpr_base.h"
     38#include "mpr_numeric.h"
     39#include "mpr_inout.h"
    3040
    3141// to get detailed timigs, define MPR_TIMING
     
    7282  case mprInfNumOfVars:
    7383    Werror("Wrong number of elements in given ideal %s, should be %d resp. %d!",
    74            name,pVariables+1,pVariables);
     84           name,(currRing->N)+1,(currRing->N));
    7585    break;
    7686  case mprNotZeroDim:
     
    103113  int k;
    104114
    105   int numOfVars= mtype == uResultant::denseResMat?pVariables-1:pVariables;
     115  int numOfVars= mtype == uResultant::denseResMat?(currRing->N)-1:(currRing->N);
    106116  if ( rmatrix ) numOfVars++;
    107117
     
    121131  }
    122132
    123   if ( !(rField_is_R()||
    124          rField_is_Q()||
    125          rField_is_long_R()||
    126          rField_is_long_C()||
    127          (rmatrix && rField_is_Q_a())) )
     133  if ( !(rField_is_R(currRing)||
     134         rField_is_Q(currRing)||
     135         rField_is_long_R(currRing)||
     136         rField_is_long_C(currRing)||
     137         (rmatrix && rField_is_Q_a(currRing))) )
    128138    state= mprUnSupField;
    129139
  • numeric/mpr_inout.h

    rb9cf41 r08e15e7  
    1818
    1919/** solve a multipolynomial system using the u-resultant
    20  * Input ideal must be 0-dimensional and pVariables == IDELEMS(ideal).
     20 * Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal).
    2121 * Resultant method can be MPR_DENSE, which uses Macaulay Resultant (good for
    2222 * dense homogeneous polynoms) or MPR_SPARSE, which uses Sparse Resultant
  • numeric/mpr_numeric.cc

    rb9cf41 r08e15e7  
    1010*/
    1111
     12#include <math.h>
     13
    1214#include <kernel/mod2.h>
     15
     16#include <misc/auxiliary.h>
     17#include <omalloc/omalloc.h>
     18
    1319//#ifdef HAVE_MPR
    1420
     
    1622
    1723//-> includes
    18 #include <kernel/options.h>
     24#include <misc/mylimits.h>
     25#include <misc/options.h>
     26#include <misc/intvec.h>
     27
     28#include <coeffs/numbers.h>
     29#include <coeffs/mpr_global.h>
     30
     31#include <polys/matpol.h>
     32
    1933#include <kernel/febase.h>
    20 #include <omalloc/omalloc.h>
    21 #include <kernel/numbers.h>
    2234#include <kernel/polys.h>
    2335#include <kernel/ideals.h>
    24 #include <kernel/intvec.h>
    25 #include <kernel/matpol.h>
    26 #include <kernel/ring.h>
     36
     37#include <kernel/febase.h>
     38#include <kernel/polys.h>
     39#include <kernel/ideals.h>
     40
    2741//#include "longrat.h"
    2842
     43#include "mpr_numeric.h"
     44
    2945#include <math.h>
    30 #include <kernel/mpr_numeric.h>
    3146
    3247extern size_t gmp_output_digits;
     
    404419    {
    405420      gmp_complex *tmp= new gmp_complex();
    406       *tmp= numberToComplex(ievpoint[i]);
     421      *tmp= numberToComplex(ievpoint[i], currRing->cf);
    407422      return *tmp;
    408423    }
     
    454469  {
    455470    ad[i]= new gmp_complex();
    456     if ( coeffs[i] ) *ad[i] = numberToComplex( coeffs[i] );
     471    if ( coeffs[i] ) *ad[i] = numberToComplex( coeffs[i], currRing->cf );
    457472  }
    458473
     
    13721387// compile-command-2: "make install" ***
    13731388// End: ***
     1389
  • numeric/mpr_numeric.h

    rb9cf41 r08e15e7  
    171171  bool found_roots;
    172172};
     173
     174
     175
    173176//<-
    174177
Note: See TracChangeset for help on using the changeset viewer.