- Timestamp:
- Nov 12, 1998, 12:30:35 PM (26 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 34d6f42f61bfd439639eff7a2395f1b848813e71
- Parents:
- 6977085b415cc22dcd4aced38b8ad2dd839781aa
- Location:
- MP/MPT
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MP/MPT/GP.h
r697708 rd14dc0 71 71 bool IsDataOk(const void* data); 72 72 bool IsOk(const void* data) {return IsSpecOk() && IsDataOk(data);} 73 bool Equals(GP_pt other) {return false;} 73 74 }; 74 75 … … 176 177 GP_QuotientCompType, 177 178 GP_VectorCompType, 178 GP_MatrixCompType 179 GP_MatrixCompType, 180 GP_FreeModuleCompType 179 181 } GP_CompType_t; 180 182 … … 191 193 // Iterator over Elmenets 192 194 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) 195 198 {dx = -1; dy = -1;} 199 200 // only relevant fro Free modules 201 virtual int FreeModuleComponent(void* data); 202 virtual void* FreeModuleElement(void* data); 196 203 }; 197 204 … … 319 326 320 327 // 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) {} 322 329 323 330 // for SparseDistPolys, we need another iterator … … 407 414 virtual GP_Iterator_pt BlockOrderingIterator() {return NULL;} 408 415 409 virtual void BlockL imits(const void* block, int &low, int &high)410 {l ow = -1; high = 0;}416 virtual void BlockLength(const void* block, int &length) 417 {length = -1;} 411 418 412 419 private: … … 414 421 }; 415 422 416 417 #if 0418 /***************************************************************419 ***************************************************************420 **421 ** Some other helpful classes422 **423 ***************************************************************424 ***************************************************************/425 // using CompleteVarNames, you do not have to bother any more about426 // having less variable names then actual variables427 class GP_CompleteVarNames_t428 {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 the439 // given prefix and constructs a varname by appending the number to440 // the prefix441 char* VarName(MP_NumChild_t i);442 };443 444 445 /***************************************************************446 ***************************************************************447 **448 ** Some useful macros and utilities449 **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_t473 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 else505 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 NDEBUG513 #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 #else527 #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 #endif535 536 #endif537 538 423 #endif // _GP_H_ 539 424 -
MP/MPT/GP_IsOk.cc
r697708 rd14dc0 65 65 return false; 66 66 67 if ((type == GP_ModuloAtomType || type == GP_ ModuloAtomType) &&67 if ((type == GP_ModuloAtomType || type == GP_CharPAtomType) && 68 68 GP_AtomModulus() == NULL) 69 69 return false; … … 146 146 { 147 147 int dx, dy; 148 MatrixDimension(d ata, dx, dy);148 MatrixDimension(dx, dy); 149 149 if (dx < 0 || dy < 0) return false; 150 150 if (dx*dy != n) return false; … … 404 404 bool GP_Ordering_t::IsBlockOrderingOk(const void* block_ordering) 405 405 { 406 int l ow, high;407 408 BlockLimits(block_ordering, l ow, high);409 410 if (l ow < 0 || high < low) return false;406 int length; 407 408 BlockLimits(block_ordering, length); 409 410 if (length <= NULL) return false; 411 411 412 412 switch (OrderingType(block_ordering)) … … 420 420 GP_Iterator_pt iter = WeightsIterator(); 421 421 if (iter == NULL) return false; 422 if (iter->N() != (high - low)*(high - low)) return false;422 if (iter->N() != length*length) return false; 423 423 return true; 424 424 } … … 484 484 } 485 485 486 // 487 //OBJECTS = mpGP.o 488 // 489 //olaf.mdm: $(OBJECTS) olaf.cc 490 // mmg -g -v olaf.cc $(OBJECTS) 491 // 492 493 MFUNC( 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.