Changeset dffd154 in git for Singular/dyn_modules/gfanlib/witness.cc
- Timestamp:
- Sep 20, 2014, 1:53:38 AM (10 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 4664b33f793e7e511d9722557720dd523ec89856
- Parents:
- b71400abefd0c9c66c0009063f40ddd5b1f1c4c7
- git-author:
- Yue Ren <ren@mathematik.uni-kl.de>2014-09-20 01:53:38+02:00
- git-committer:
- Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:05+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/gfanlib/witness.cc
rb71400a rdffd154 7 7 #include <utility> 8 8 9 /***10 * Given f and G={g1,...,gk}, computes Q=(q1,...,qk) such that11 * f = q1*g1+...+qk*gk12 * is a determinate division with remainder with respect to the13 * ordering active in r.14 * Returns an error if this is not possible.15 **/16 9 matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r) 17 10 { … … 26 19 } 27 20 28 /**29 * Given F[0],...,F[l] and G[0],...,G[k],30 * computes Q[i,j] for i=0,..,k and j=0,...,l such that31 * F[j] = Q[0,j]*G[0]+...+Q[k,j]*G[k].32 */33 21 matrix divisionDiscardingRemainder(const ideal F, const ideal G, const ring r) 34 22 { … … 44 32 } 45 33 46 #ifndef NDEBUG47 BOOLEAN dwr0(leftv res, leftv args)48 {49 leftv u = args;50 leftv v = u->next;51 poly f = (poly) u->CopyD();52 ideal G = (ideal) v->CopyD();53 omUpdateInfo();54 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);55 matrix Q = divisionDiscardingRemainder(f,G,currRing);56 p_Delete(&f,currRing);57 id_Delete(&G,currRing);58 res->rtyp = MATRIX_CMD;59 res->data = (char*) Q;60 return FALSE;61 }62 #endif63 64 /***65 * Let w be the uppermost weight vector in the matrix defining the ordering on r.66 * Let I be a Groebner basis of an ideal in r, inI its initial form with respect w.67 * Given an w-homogeneous element m of inI, computes a witness g of m in I,68 * i.e. g in I such that in_w(g)=m.69 **/70 34 poly witness(const poly m, const ideal I, const ideal inI, const ring r) 71 35 { … … 86 50 } 87 51 88 #ifndef NDEBUG89 BOOLEAN witness0(leftv res, leftv args)90 {91 leftv u = args;92 leftv v = u->next;93 leftv w = v->next;94 poly m = (poly) u->CopyD();95 ideal G = (ideal) v->CopyD();96 ideal inG = (ideal) w->CopyD();97 omUpdateInfo();98 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes);99 poly f = witness(m,G,inG,currRing);100 p_Delete(&m,currRing);101 id_Delete(&G,currRing);102 id_Delete(&inG,currRing);103 res->rtyp = POLY_CMD;104 res->data = (char*) f;105 return FALSE;106 }107 #endif108 109 /***110 * Let w be the uppermost weight vector in the matrix defining the ordering on r.111 * Let I be a Groebner basis of an ideal in r, inI its initial form with respect w.112 * Given an w-homogeneous element m of inI, computes a witness g of m in I,113 * i.e. g in I such that in_w(g)=m.114 **/115 52 ideal witness(const ideal inI, const ideal J, const ring r) 116 53 { … … 132 69 return I; 133 70 } 71 72 #ifndef NDEBUG 73 BOOLEAN dwrDebug(leftv res, leftv args) 74 { 75 leftv u = args; 76 leftv v = u->next; 77 ideal F = (ideal) u->CopyD(); 78 ideal G = (ideal) v->CopyD(); 79 omUpdateInfo(); 80 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 81 matrix Q = divisionDiscardingRemainder(F,G,currRing); 82 id_Delete(&F,currRing); 83 id_Delete(&G,currRing); 84 res->rtyp = MATRIX_CMD; 85 res->data = (char*) Q; 86 return FALSE; 87 } 88 89 BOOLEAN witnessDebug(leftv res, leftv args) 90 { 91 leftv u = args; 92 leftv v = u->next; 93 ideal inI = (ideal) u->CopyD(); 94 ideal J = (ideal) v->CopyD(); 95 omUpdateInfo(); 96 Print("usedBytesBefore=%ld\n",om_Info.UsedBytes); 97 ideal I = witness(inI,J,currRing); 98 id_Delete(&inI,currRing); 99 id_Delete(&J,currRing); 100 res->rtyp = IDEAL_CMD; 101 res->data = (char*) I; 102 return FALSE; 103 } 104 #endif
Note: See TracChangeset
for help on using the changeset viewer.