Ignore:
Timestamp:
Sep 20, 2014, 1:53:38 AM (10 years ago)
Author:
Yue Ren <ren@…>
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
Message:
chg: status update 20.09.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/gfanlib/witness.cc

    rb71400a rdffd154  
    77#include <utility>
    88
    9 /***
    10  * Given f and G={g1,...,gk}, computes Q=(q1,...,qk) such that
    11  * f = q1*g1+...+qk*gk
    12  * is a determinate division with remainder with respect to the
    13  * ordering active in r.
    14  * Returns an error if this is not possible.
    15  **/
    169matrix divisionDiscardingRemainder(const poly f, const ideal G, const ring r)
    1710{
     
    2619}
    2720
    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 that
    31  * F[j] = Q[0,j]*G[0]+...+Q[k,j]*G[k].
    32  */
    3321matrix divisionDiscardingRemainder(const ideal F, const ideal G, const ring r)
    3422{
     
    4432}
    4533
    46 #ifndef NDEBUG
    47 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 #endif
    63 
    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  **/
    7034poly witness(const poly m, const ideal I, const ideal inI, const ring r)
    7135{
     
    8650}
    8751
    88 #ifndef NDEBUG
    89 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 #endif
    108 
    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  **/
    11552ideal witness(const ideal inI, const ideal J, const ring r)
    11653{
     
    13269  return I;
    13370}
     71
     72#ifndef NDEBUG
     73BOOLEAN 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
     89BOOLEAN 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.