Changeset 12f6ce0 in git


Ignore:
Timestamp:
Aug 22, 2013, 3:35:23 PM (11 years ago)
Author:
Janko Boehm <boehm@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '45e267b9942dec9429fe249ce3e5e44ab80a6a3a')
Children:
5d258e90f0942cca8fc2fed57ff1d4c5ecdbc20a
Parents:
2e4ee2b73c0c10b254963f2c5bb24ce6688d1f5b
git-author:
Janko Boehm <boehm@mathematik.uni-kl.de>2013-08-22 15:35:23+02:00
git-committer:
Janko Boehm <boehm@mathematik.uni-kl.de>2013-09-03 19:36:11+02:00
Message:
Added differentiation of coefficients in transcendental extensions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r2e4ee2b r12f6ce0  
    3333#include <Singular/mod_lib.h>
    3434#include <polys/weight.h>
    35 
     35#include <polys/ext_fields/transext.h>
    3636
    3737#include <kernel/stairc.h>
     
    43664366  }
    43674367  res->data = (char *)i;
     4368  return FALSE;
     4369}
     4370static BOOLEAN jjDIFF_COEF(leftv res, leftv u, leftv v)
     4371{
     4372  if (currRing->cf->type!=n_transExt)
     4373  {
     4374    WerrorS("differentiation not defined in the coefficient ring");
     4375    return TRUE;
     4376  }
     4377  number n = (number) u->Data();
     4378  number k = (number) v->Data();
     4379  res->data = ntDiff(n,k,currRing->cf);
    43684380  return FALSE;
    43694381}
  • Singular/table.h

    r2e4ee2b r12f6ce0  
    522522,{D(jjDIFF_ID),   DIFF_CMD,       MODUL_CMD,      MODUL_CMD,  POLY_CMD, ALLOW_PLURAL |ALLOW_RING}
    523523,{D(jjDIFF_ID),   DIFF_CMD,       MATRIX_CMD,     MATRIX_CMD, POLY_CMD, ALLOW_PLURAL |ALLOW_RING}
     524,{D(jjDIFF_COEF), DIFF_CMD,       NUMBER_CMD,     NUMBER_CMD, NUMBER_CMD, ALLOW_PLURAL |ALLOW_RING}
    524525,{D(jjDIM2),      DIM_CMD,        INT_CMD,        IDEAL_CMD,  IDEAL_CMD, ALLOW_PLURAL |NO_RING}
    525526,{D(jjDIM2),      DIM_CMD,        INT_CMD,        MODUL_CMD,  IDEAL_CMD, ALLOW_PLURAL |NO_RING}
  • libpolys/polys/ext_fields/transext.cc

    r2e4ee2b r12f6ce0  
    3333*           TODO: the description above needs a major update!!!
    3434*/
     35
     36
     37
     38
     39
    3540#define TRANSEXT_PRIVATES
    3641
     
    6772#define ADD_COMPLEXITY 1   /**< complexity increase due to + and - */
    6873#define MULT_COMPLEXITY 2   /**< complexity increase due to * and / */
     74#define DIFF_COMPLEXITY 2   /**< complexity increase due to * and / */
    6975#define BOUND_COMPLEXITY 10   /**< maximum complexity of a number */
    7076
     
    740746*/
    741747}
     748
     749number ntDiff(number a, number d, const coeffs cf)
     750{
     751  ntTest(a);
     752  ntTest(d);
     753
     754  fraction t = (fraction) d;
     755  if (!DENIS1(t))
     756  {
     757    WerrorS("expected differentiation by a variable");
     758    return a;
     759  }
     760  int k=p_Var(NUM(t),ntRing);
     761  if (k==0)
     762  {
     763    WerrorS("expected differentiation by a variable");
     764    return a;
     765  }
     766
     767  if (IS0(a)) return ntCopy(a, cf);
     768
     769  fraction fa = (fraction)a;
     770
     771  poly g = p_Copy(NUM(fa), ntRing);
     772  poly f = p_Copy(DEN(fa), ntRing);
     773  poly dg =p_Diff(g,k,ntRing);
     774
     775  if (DENIS1(fa)) {
     776
     777     fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
     778     NUM(result) = dg;
     779     DEN(result) = NULL;
     780     COM(result) = COM(fa);
     781     return (number)result;
     782  }
     783
     784  poly df =p_Diff(f,k,ntRing);
     785  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
     786  poly fg = p_Mult_q(p_Copy(f,ntRing),dg,ntRing);
     787  poly gf = p_Neg(p_Mult_q(g,df,ntRing),ntRing);
     788  NUM(result) = p_Add_q(fg,gf,ntRing);
     789  DEN(result) = p_Mult_q(p_Copy(f,ntRing), f, ntRing);
     790  COM(result) = COM(fa) + COM(fa) + DIFF_COMPLEXITY;
     791  heuristicGcdCancellation((number)result, cf);
     792
     793  return (number)result;
     794}
     795
    742796
    743797number ntAdd(number a, number b, const coeffs cf)
  • libpolys/polys/ext_fields/transext.h

    r2e4ee2b r12f6ce0  
    9898BOOLEAN  ntInitChar(coeffs cf, void* infoStruct);
    9999
     100number ntDiff(number a, number d, const coeffs cf);
     101
    100102/* Private hidden interface
    101103BOOLEAN  ntGreaterZero(number a, const coeffs cf);
Note: See TracChangeset for help on using the changeset viewer.