Changeset 1745e5 in git
- Timestamp:
- Aug 1, 2011, 4:07:53 PM (12 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 57592b355247b69310d60aa0448d638c327ad3e8
- Parents:
- 283ef732868790f43d179f5c606f84691eaba355
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-08-01 16:07:53+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:01:18+01:00
- Files:
-
- 7 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/makefile
r283ef7 r1745e5 65 65 hdegree.cc hilb.cc hutil.cc \ 66 66 gr_kstd2.cc \ 67 ideals.cc int64vec.cc\67 ideals.cc \ 68 68 khstd.cc kstdfac.cc \ 69 69 kstd1.cc kstd2.cc kutil.cc \ … … 97 97 98 98 HEADERS=hutil.h idrec.h stairc.h ideals.h \ 99 structs.h int64vec.h\99 structs.h \ 100 100 syz.h \ 101 101 fast_maps.h \ -
kernel/structs.h
r283ef7 r1745e5 26 26 27 27 #define BITSET unsigned int 28 29 #if SIZEOF_LONG == 430 typedef long long int64;31 #elif SIZEOF_LONG == 832 typedef long int64;33 #else34 #error int64 undefined35 #endif36 28 37 29 -
kernel/walkSupport.cc
r283ef7 r1745e5 2 2 #include <kernel/mod2.h> 3 3 #include <misc/intvec.h> 4 #include < kernel/int64vec.h>4 #include <misc/int64vec.h> 5 5 #include <polys/polys.h> 6 6 #include <kernel/ideals.h> … … 253 253 } 254 254 255 /////////////////////////////////////////////////////////////////// 256 //scalarProduct64 257 /////////////////////////////////////////////////////////////////// 258 //Description: returns the scalar product of int64vecs a and b 259 /////////////////////////////////////////////////////////////////// 260 //Assume: Overflow tests assumes input has nonnegative entries 261 /////////////////////////////////////////////////////////////////// 262 //Uses: none 263 /////////////////////////////////////////////////////////////////// 264 265 static inline int64 scalarProduct64(int64vec* a, int64vec* b) 266 { 267 assume( a->length() == b->length()); 268 int i, n = a->length(); 269 int64 result = 0; 270 int64 temp1,temp2; 271 for(i=n-1; i>=0; i--) 272 { 273 temp1=(*a)[i] * (*b)[i]; 274 if((*a)[i]!=0 && (temp1/(*a)[i])!=(*b)[i]) overflow_error=1; 275 276 temp2=result; 277 result += temp1; 278 279 //since both vectors always have nonnegative entries in init64 280 //result should be >=temp2 281 if(temp2>result) overflow_error=2; 282 } 283 284 return result; 285 } 255 286 /////////////////////////////////////////////////////////////////// 256 287 … … 790 821 791 822 792 ///////////////////////////////////////////////////////////////////793 //scalarProduct64794 ///////////////////////////////////////////////////////////////////795 //Description: returns the scalar product of int64vecs a and b796 ///////////////////////////////////////////////////////////////////797 //Assume: Overflow tests assumes input has nonnegative entries798 ///////////////////////////////////////////////////////////////////799 //Uses: none800 ///////////////////////////////////////////////////////////////////801 802 static inline int64 scalarProduct64(int64vec* a, int64vec* b)803 {804 assume( a->length() == b->length());805 int i, n = a->length();806 int64 result = 0;807 int64 temp1,temp2;808 for(i=n-1; i>=0; i--)809 {810 temp1=(*a)[i] * (*b)[i];811 if((*a)[i]!=0 && (temp1/(*a)[i])!=(*b)[i]) overflow_error=1;812 813 temp2=result;814 result += temp1;815 816 //since both vectors always have nonnegative entries in init64817 //result should be >=temp2818 if(temp2>result) overflow_error=2;819 }820 821 return result;822 }823 823 824 824 /////////////////////////////////////////////////////////////////// … … 1004 1004 rChangeCurrRing(rnew); 1005 1005 } 1006 1007 ///////////////////////////////////////////////////////////////////1008 1009 1010 ///////////////////////////////////////////////////////////////////1011 //rCopy0AndAddA1012 ///////////////////////////////////////////////////////////////////1013 //Description: returns a copy of currRing with the1014 //int64vec wv64 added in front of the current order1015 //i.e. if old order was O, then the new one will be (A(w),O)1016 ///////////////////////////////////////////////////////////////////1017 //Uses: omAllocBin,memcpy,sizeof,nCopy,omStrDup,omMemDup,1018 //idrCopyR_NoSort1019 ///////////////////////////////////////////////////////////////////1020 1021 ring rCopy0AndAddA(ring r, int64vec *wv64, BOOLEAN copy_qideal,1022 BOOLEAN copy_ordering)1023 {1024 1025 if (r == NULL) return NULL;1026 int i,j;1027 ring res=(ring)omAllocBin(sip_sring_bin);1028 1029 memcpy(res,r,sizeof(ip_sring));1030 res->VarOffset = NULL;1031 res->ref=0;1032 if (r->extRing!=NULL)1033 r->extRing->ref++;1034 if (r->parameter!=NULL)1035 {1036 res->minpoly=nCopy(r->minpoly);1037 int l=rPar(r);1038 res->parameter=(char **)omAlloc(l*sizeof(char_ptr));1039 int i;1040 for(i=0;i<rPar(r);i++)1041 {1042 res->parameter[i]=omStrDup(r->parameter[i]);1043 }1044 }1045 1046 i=rBlocks(r);1047 res->wvhdl = (int **)omAlloc((i+1) * sizeof(int_ptr));1048 res->order = (int *) omAlloc((i+1) * sizeof(int));1049 res->block0 = (int *) omAlloc((i+1) * sizeof(int));1050 res->block1 = (int *) omAlloc((i+1) * sizeof(int));1051 for (j=0; j<i; j++)1052 {1053 if (r->wvhdl[j]!=NULL)1054 {1055 res->wvhdl[j+1] = (int*) omMemDup(r->wvhdl[j]);1056 }1057 else1058 res->wvhdl[j+1]=NULL;1059 }1060 for (j=0;j<i;j++)1061 {1062 res->order[j+1]=r->order[j];1063 res->block0[j+1]=r->block0[j];1064 res->block1[j+1]=r->block1[j];1065 }1066 1067 //the added A1068 res->order[0]=ringorder_a64;1069 int length=wv64->rows();1070 int64 *A=(int64 *)omAlloc(length*sizeof(int64));1071 for(j=length-1;j>=0;j--)1072 {1073 A[j]=(*wv64)[j];1074 }1075 res->wvhdl[0]=(int *)A;1076 res->block0[0]=1;1077 res->block1[0]=length;1078 1079 res->names = (char **)omAlloc0(rVar(r) * sizeof(char_ptr));1080 for (i=rVar(res)-1;i>=0; i--)1081 {1082 res->names[i] = omStrDup(r->names[i]);1083 }1084 res->idroot = NULL;1085 if (r->qideal!=NULL)1086 {1087 if (copy_qideal) res->qideal= idrCopyR_NoSort(r->qideal, r);1088 else res->qideal = NULL;1089 }1090 1091 return res;1092 }1093 1094 ///////////////////////////////////////////////////////////////////1095 1096 1006 1097 1007 /////////////////////////////////////////////////////////////////// -
kernel/walkSupport.h
r283ef7 r1745e5 3 3 4 4 #include <misc/intvec.h> 5 #include < kernel/int64vec.h>5 #include <misc/int64vec.h> 6 6 7 7 int tdeg(poly p); … … 30 30 matrix matIdLift(ideal Gomega, ideal M); 31 31 void rCopyAndChangeA(int64vec* w); 32 ring rCopy0AndAddA(ring r, int64vec *wv64, BOOLEAN copy_qideal = TRUE,33 BOOLEAN copy_ordering = TRUE);34 32 int64vec* rGetGlobalOrderMatrix(ring r); 35 33 int64vec* rGetGlobalOrderWeightVec(ring r); -
libpolys/misc/Makefile.am
r283ef7 r1745e5 15 15 INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. 16 16 17 SOURCES = intvec.cc options.c17 SOURCES = intvec.cc int64vec.cc options.c 18 18 libmisc_a_SOURCES = $(SOURCES) 19 19 libmisc_g_a_SOURCES = $(SOURCES) … … 26 26 #libmisc_g_a_libdir=${libdir}/libpolys 27 27 28 MISCHEADERS = auxiliary.h mylimits.h options.h intvec.h 28 MISCHEADERS = auxiliary.h mylimits.h options.h intvec.h int64vec.h 29 29 libmisc_a_include_HEADERS = $(MISCHEADERS) 30 30 libmisc_g_a_include_HEADERS = $(MISCHEADERS) -
libpolys/misc/int64vec.cc
r283ef7 r1745e5 6 6 * ABSTRACT: class int64vec: lists/vectors of int64 7 7 */ 8 #include <kernel/mod2.h> 9 #include <kernel/structs.h> 10 #include <kernel/febase.h> 11 #include <kernel/int64vec.h> 8 #include <misc/int64vec.h> 12 9 #include <misc/intvec.h> 13 10 #include <omalloc/omalloc.h> -
libpolys/misc/int64vec.h
r283ef7 r1745e5 9 9 */ 10 10 #include <string.h> 11 #include <kernel/structs.h>12 11 #include <omalloc/omalloc.h> 13 #include < kernel/febase.h>12 #include <misc/auxiliary.h> 14 13 #include <misc/intvec.h> 15 14 … … 79 78 int64vec * iv=new int64vec(o); 80 79 return iv; 81 } ;80 } 82 81 83 82 int64vec * iv64Add(int64vec * a, int64vec * b); -
libpolys/polys/monomials/ring.cc
r283ef7 r1745e5 13 13 #include <omalloc/omalloc.h> 14 14 #include <misc/options.h> 15 #include <misc/int vec.h>15 #include <misc/int64vec.h> 16 16 17 17 #include <coeffs/numbers.h> … … 1297 1297 1298 1298 /*2 1299 * create a copy of the ring r , which must be equivalent to currRing1299 * create a copy of the ring r 1300 1300 * used for qring definition,.. 1301 * (i.e.: normal rings: same nCopy as currRing;1302 * qring: same nCopy, same idCopy as currRing)1303 1301 * DOES NOT CALL rComplete 1304 1302 */ … … 1414 1412 //memset: res->block1 = NULL; 1415 1413 //memset: } 1414 1415 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *)); 1416 for (i=0; i<rVar(res); i++) 1417 { 1418 res->names[i] = omStrDup(r->names[i]); 1419 } 1420 if (r->qideal!=NULL) 1421 { 1422 if (copy_qideal) 1423 { 1424 #ifndef NDEBUG 1425 if (!copy_ordering) 1426 WerrorS("internal error: rCopy0(Q,TRUE,FALSE)"); 1427 else 1428 #endif 1429 { 1430 #ifndef NDEBUG 1431 WarnS("internal bad stuff: rCopy0(Q,TRUE,TRUE)"); 1432 #endif 1433 rComplete(res); 1434 res->qideal= idrCopyR_NoSort(r->qideal, r, res); 1435 rUnComplete(res); 1436 } 1437 } 1438 //memset: else res->qideal = NULL; 1439 } 1440 //memset: else res->qideal = NULL; 1441 //memset: res->GetNC() = NULL; // copy is purely commutative!!! 1442 return res; 1443 } 1444 1445 /*2 1446 * create a copy of the ring r 1447 * used for qring definition,.. 1448 * DOES NOT CALL rComplete 1449 */ 1450 ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering) 1451 { 1452 if (r == NULL) return NULL; 1453 int i,j; 1454 ring res=(ring)omAllocBin(sip_sring_bin); 1455 memset(res,0,sizeof(ip_sring)); 1456 //memcpy(res,r,sizeof(ip_sring)); 1457 //memset: res->idroot=NULL; /* local objects */ 1458 //ideal minideal; 1459 res->options=r->options; /* ring dependent options */ 1460 1461 //memset: res->ordsgn=NULL; 1462 //memset: res->typ=NULL; 1463 //memset: res->VarOffset=NULL; 1464 //memset: res->firstwv=NULL; 1465 1466 //struct omBin PolyBin; /* Bin from where monoms are allocated */ 1467 //memset: res->PolyBin=NULL; // rComplete 1468 res->cf=r->cf; /* coeffs */ 1469 res->cf->ref++; 1470 1471 //memset: res->ref=0; /* reference counter to the ring */ 1472 1473 res->float_len=r->float_len; /* additional char-flags */ 1474 res->float_len2=r->float_len2; /* additional char-flags */ 1475 1476 res->N=rVar(r); /* number of vars */ 1477 res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */ 1478 1479 res->firstBlockEnds=r->firstBlockEnds; 1480 #ifdef HAVE_PLURAL 1481 res->real_var_start=r->real_var_start; 1482 res->real_var_end=r->real_var_end; 1483 #endif 1484 1485 #ifdef HAVE_SHIFTBBA 1486 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */ 1487 #endif 1488 1489 res->VectorOut=r->VectorOut; 1490 res->ShortOut=r->ShortOut; 1491 res->CanShortOut=r->CanShortOut; 1492 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks 1493 res->MixedOrder=r->MixedOrder; // ?? 1 for lex ordering (except ls), -1 otherwise 1494 res->ComponentOrder=r->ComponentOrder; 1495 1496 //memset: res->ExpL_Size=0; 1497 //memset: res->CmpL_Size=0; 1498 //memset: res->VarL_Size=0; 1499 //memset: res->pCompIndex=0; 1500 //memset: res->pOrdIndex=0; 1501 //memset: res->OrdSize=0; 1502 //memset: res->VarL_LowIndex=0; 1503 //memset: res->MinExpPerLong=0; 1504 //memset: res->NegWeightL_Size=0; 1505 //memset: res->NegWeightL_Offset=NULL; 1506 //memset: res->VarL_Offset=NULL; 1507 1508 // the following are set by rComplete unless predefined 1509 // therefore, we copy these values: maybe they are non-standard 1510 /* mask for getting single exponents */ 1511 res->bitmask=r->bitmask; 1512 res->divmask=r->divmask; 1513 res->BitsPerExp = r->BitsPerExp; 1514 res->ExpPerLong = r->ExpPerLong; 1515 1516 //memset: res->p_Procs=NULL; 1517 //memset: res->pFDeg=NULL; 1518 //memset: res->pLDeg=NULL; 1519 //memset: res->pFDegOrig=NULL; 1520 //memset: res->pLDegOrig=NULL; 1521 //memset: res->p_Setm=NULL; 1522 //memset: res->cf=NULL; 1523 res->options=r->options; 1524 1525 /* 1526 if (r->extRing!=NULL) 1527 r->extRing->ref++; 1528 1529 res->extRing=r->extRing; 1530 //memset: res->minideal=NULL; 1531 */ 1532 1533 1534 if (copy_ordering == TRUE) 1535 { 1536 i=rBlocks(r)+1; // DIFF to rCopy0 1537 res->wvhdl = (int **)omAlloc(i * sizeof(int *)); 1538 res->order = (int *) omAlloc(i * sizeof(int)); 1539 res->block0 = (int *) omAlloc(i * sizeof(int)); 1540 res->block1 = (int *) omAlloc(i * sizeof(int)); 1541 for (j=0; j<i-1; j++) 1542 { 1543 if (r->wvhdl[j]!=NULL) 1544 { 1545 res->wvhdl[j+1] = (int*) omMemDup(r->wvhdl[j]); //DIFF 1546 } 1547 else 1548 res->wvhdl[j+1]=NULL; //DIFF 1549 } 1550 memcpy(&(res->order[1]),r->order,(i-1) * sizeof(int)); //DIFF 1551 memcpy(&(res->block0[1]),r->block0,(i-1) * sizeof(int)); //DIFF 1552 memcpy(&(res->block1[1]),r->block1,(i-1) * sizeof(int)); //DIFF 1553 } 1554 //memset: else 1555 //memset: { 1556 //memset: res->wvhdl = NULL; 1557 //memset: res->order = NULL; 1558 //memset: res->block0 = NULL; 1559 //memset: res->block1 = NULL; 1560 //memset: } 1561 1562 //the added A 1563 res->order[0]=ringorder_a64; 1564 int length=wv64->rows(); 1565 int64 *A=(int64 *)omAlloc(length*sizeof(int64)); 1566 for(j=length-1;j>=0;j--) 1567 { 1568 A[j]=(*wv64)[j]; 1569 } 1570 res->wvhdl[0]=(int *)A; 1571 res->block0[0]=1; 1572 res->block1[0]=length; 1573 // 1416 1574 1417 1575 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *)); -
libpolys/polys/monomials/ring.h
r283ef7 r1745e5 28 28 typedef struct ip_sring * ring; 29 29 class intvec; 30 class int64vec; 30 31 struct p_Procs_s; 31 32 typedef struct p_Procs_s p_Procs_s; … … 346 347 ring rCopy(ring r); 347 348 ring rCopy0(const ring r, BOOLEAN copy_qideal = TRUE, BOOLEAN copy_ordering = TRUE); 349 ring rCopy0AndAddA(ring r, int64vec *wv64, BOOLEAN copy_qideal = TRUE, 350 BOOLEAN copy_ordering = TRUE); 348 351 ring rOpposite(ring r); 349 352 ring rEnvelope(ring r);
Note: See TracChangeset
for help on using the changeset viewer.