Changeset d14dc0 in git for MP/MPT


Ignore:
Timestamp:
Nov 12, 1998, 12:30:35 PM (26 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
34d6f42f61bfd439639eff7a2395f1b848813e71
Parents:
6977085b415cc22dcd4aced38b8ad2dd839781aa
Message:
* changes from MuapadGP


git-svn-id: file:///usr/local/Singular/svn/trunk@2665 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
MP/MPT
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MP/MPT/GP.h

    r697708 rd14dc0  
    7171  bool IsDataOk(const void* data);
    7272  bool IsOk(const void* data) {return IsSpecOk() && IsDataOk(data);}
     73  bool Equals(GP_pt other) {return false;}
    7374};
    7475
     
    176177  GP_QuotientCompType,
    177178  GP_VectorCompType,
    178   GP_MatrixCompType
     179  GP_MatrixCompType,
     180  GP_FreeModuleCompType
    179181} GP_CompType_t;
    180182
     
    191193  // Iterator over Elmenets
    192194  virtual   GP_Iterator_pt  ElementDataIterator(const void* data)  = 0;
    193    
    194   virtual void MatrixDimension(const void* data, int &dx, int &dy)
     195
     196  // only relevant for matricies
     197  virtual void MatrixDimension(int &dx, int &dy)
    195198    {dx = -1; dy = -1;}
     199
     200  // only relevant fro Free modules
     201  virtual int   FreeModuleComponent(void* data);
     202  virtual void* FreeModuleElement(void* data);
    196203};
    197204
     
    319326
    320327  // for DenseDistPoly, we simply let the Exp Vector be filled
    321   virtual void       ExpVector(const void* monom, int* &expvector) {}
     328  virtual void       ExpVector(const void* monom, long* &expvector) {}
    322329
    323330  // for SparseDistPolys, we need another iterator
     
    407414  virtual GP_Iterator_pt BlockOrderingIterator() {return NULL;}
    408415
    409   virtual void BlockLimits(const void* block, int &low, int &high)
    410     {low = -1; high = 0;}
     416  virtual void BlockLength(const void* block, int &length)
     417    {length = -1;}
    411418
    412419private:
     
    414421};
    415422
    416 
    417 #if 0
    418 /***************************************************************
    419  ***************************************************************
    420  **
    421  ** Some other helpful classes
    422  **
    423  ***************************************************************
    424  ***************************************************************/
    425 // using CompleteVarNames, you do not have to bother any more about
    426 // having less variable names then actual variables
    427 class GP_CompleteVarNames_t
    428 {
    429   char  tmp[20];
    430   char* prefix;
    431   MP_Sint32_t vardiff;
    432   MP_Uint32_t varnamesnumber;
    433   GP_MvPoly_pt pspec;
    434 
    435 public:
    436   GP_CompleteVarNames_t(GP_MvPoly_pt polyspec, char* prefix);
    437   MP_NumChild_t     VarNamesNumber();
    438   // if there are more variables then variable names, VarName uses the
    439   // given prefix and constructs a varname by appending the number to
    440   // the prefix
    441   char*             VarName(MP_NumChild_t i);
    442 };
    443 
    444 
    445 /***************************************************************
    446  ***************************************************************
    447  **
    448  ** Some useful macros and utilities
    449  **
    450  ***************************************************************
    451  ***************************************************************/
    452 
    453 inline GP_OrderingType_t GP_CcPolyOrdering_2_OrderingType(MP_Common_t cc)
    454 {
    455   switch(cc)
    456   {
    457       case  MP_CcPolyOrdering_Lex           : return GP_LexOrdering;
    458       case  MP_CcPolyOrdering_DegRevLex     : return GP_DegRevLexOrdering;
    459       case  MP_CcPolyOrdering_DegLex        : return GP_DegLexOrdering;
    460       case  MP_CcPolyOrdering_NegLex        : return GP_NegLexOrdering;
    461       case  MP_CcPolyOrdering_NegDegRevLex  : return GP_NegDegRevLexOrdering;
    462       case  MP_CcPolyOrdering_NegDegLex     : return GP_NegDegLexOrdering;
    463       case  MP_CcPolyOrdering_Vector        : return GP_VectorOrdering;
    464       case  MP_CcPolyOrdering_Matrix        : return GP_MatrixOrdering;
    465       case  MP_CcPolyOrdering_IncComp        : return GP_IncCompOrdering;
    466       case  MP_CcPolyOrdering_DecComp       : return GP_DecCompOrdering;
    467 
    468       default : return GP_UnknownOrdering;
    469   }
    470 }
    471 
    472 inline MP_Common_t
    473 GP_OrderingType_2_CcPolyOrdering(GP_OrderingType_t ordering)
    474 {
    475   switch(ordering)
    476   {
    477       case GP_LexOrdering          : return MP_CcPolyOrdering_Lex;
    478       case GP_DegRevLexOrdering    : return MP_CcPolyOrdering_DegRevLex;
    479       case GP_DegLexOrdering       : return MP_CcPolyOrdering_DegLex;
    480       case GP_NegLexOrdering       : return MP_CcPolyOrdering_NegLex;
    481       case GP_NegDegLexOrdering    : return MP_CcPolyOrdering_NegDegLex;
    482       case GP_NegDegRevLexOrdering : return MP_CcPolyOrdering_NegDegRevLex;
    483       case GP_VectorOrdering       : return MP_CcPolyOrdering_Vector;
    484       case GP_MatrixOrdering       : return MP_CcPolyOrdering_Matrix;
    485       case GP_IncCompOrdering      : return MP_CcPolyOrdering_IncComp;
    486       case GP_DecCompOrdering      : return MP_CcPolyOrdering_DecComp;
    487 
    488       default: return MP_CcPolyOrdering_Unknown;
    489   }
    490 }
    491 
    492 extern MP_Sint32_t* g_GP_TmpVector;
    493 extern MP_Uint32_t  g_GP_TmpVectorLength;
    494 
    495 inline MP_Sint32_t* GP_GetTmpVector(MP_NumChild_t l)
    496 {
    497   if (l < g_GP_TmpVectorLength)
    498   {
    499     if (g_GP_TmpVector != NULL)
    500       g_GP_TmpVector = (MP_Sint32_t*)
    501         IMP_MemReallocFnc(g_GP_TmpVector,
    502                           l*sizeof(MP_Sint32_t),
    503                           g_GP_TmpVectorLength*sizeof(MP_Sint32_t));
    504     else
    505       g_GP_TmpVector = (MP_Sint32_t*) IMP_MemAllocFnc(l*sizeof(MP_Sint32_t));
    506    
    507       g_GP_TmpVectorLength = l;
    508   }   
    509   return g_GP_TmpVector;
    510 }
    511                                                  
    512 #ifndef NDEBUG
    513 #include <MPT.h>
    514 #define GP_Assume(x)   MPT_Assume(x)
    515 #define ERR_RTR(x)                                                            \
    516 do                                                                            \
    517 {                                                                             \
    518   MP_Status_t _status = x;                                                    \
    519   if (x != MP_Success)                                                        \
    520   {                                                                           \
    521     fprintf(stderr, "MP_Failure return in %s, Line %d, ErrorCode %d\n, Expression\n%s\n", \
    522             __FILE__, __LINE__, _status, #x);                                          \
    523     return _status;                                                                 \
    524   }                                                                           \
    525 } while(0)
    526 #else
    527 #define GP_Assume(x)   ((void)0)
    528 #define ERR_RTR(x)
    529 do                                              \
    530 {                                               \
    531   MP_Status_t _status = x;                      \
    532   if (x != MP_Success) return _status;                \
    533 } while(0)
    534 #endif
    535 
    536 #endif
    537 
    538423#endif // _GP_H_
    539424
  • MP/MPT/GP_IsOk.cc

    r697708 rd14dc0  
    6565    return false;
    6666 
    67   if ((type == GP_ModuloAtomType || type == GP_ModuloAtomType) &&
     67  if ((type == GP_ModuloAtomType || type == GP_CharPAtomType) &&
    6868      GP_AtomModulus() == NULL)
    6969    return false;
     
    146146      {
    147147        int dx, dy;
    148         MatrixDimension(data, dx, dy);
     148        MatrixDimension(dx, dy);
    149149        if (dx < 0 || dy < 0) return false;
    150150        if (dx*dy != n) return false;
     
    404404bool GP_Ordering_t::IsBlockOrderingOk(const void* block_ordering)
    405405{
    406   int low, high;
    407  
    408   BlockLimits(block_ordering, low, high);
    409  
    410   if (low < 0 || high < low) return false;
     406  int length;
     407 
     408  BlockLimits(block_ordering, length);
     409 
     410  if (length <= NULL) return false;
    411411 
    412412  switch (OrderingType(block_ordering))
     
    420420        GP_Iterator_pt iter = WeightsIterator();
    421421        if (iter == NULL) return false;
    422         if (iter->N() != (high - low)*(high - low)) return false;
     422        if (iter->N() != length*length) return false;
    423423        return true;
    424424      }
     
    484484}
    485485
     486//
     487//OBJECTS = mpGP.o
     488//
     489//olaf.mdm:     $(OBJECTS) olaf.cc
     490//              mmg -g -v olaf.cc $(OBJECTS)
     491//
     492
     493MFUNC( test, MCnop )
     494{ MFnargsCheck(1);
     495
     496  GP_pt GPobj = mpGetGP( MFarg(1) );
     497
     498  if( GPobj == NULL )
     499      MFreturn( MFcopy(MVunknown) );
     500  if( mpCheckGP(GPobj) )
     501      MFreturn( MFcopy(MVtrue) );
     502  else
     503      MFreturn( MFcopy(MVfalse) );
     504} MFEND
     505
Note: See TracChangeset for help on using the changeset viewer.