Changeset 3693cf in git


Ignore:
Timestamp:
Feb 19, 2013, 9:45:45 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '3a4bc649f1d0185cc9f8b122bd75f21f75ac9c9a')
Children:
5e42ec33c5a0d777cb71dc36d36924181f7d88b3
Parents:
fd60be56d6b370a06c2d461f568680391606dbc1236a4c0b334deb5ef1062f5eeac7f6bcaf807f35
Message:
Merge pull request #284 from YueRen/thurnau

Thurnau
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r236a4c r3693cf  
    1010.libs
    1111doc/
     12AUTOGEN_generated_stuff
    1213MOD
    1314libsingular-config
     
    110111stamp-h1
    111112stamp-h2
    112 
     113test-driver
    113114singular.png
  • Makefile.am

    r236a4c r3693cf  
    1515
    1616emacsdir=$(datadir)/emacs
    17 dist_emacs_DATA = emacs/BUGS \
     17EMACS = emacs/BUGS \
    1818    emacs/ChangeLog \
    1919    emacs/cmpl.pl \
     
    2727    emacs/singular.xpm
    2828
     29dist_emacs_DATA = $(EMACS)
     30
    2931# emacs/test.sing
    3032# TODO: remove this!
     
    3335
    3436
    35 EXTRA_DIST = autogen.sh emacs
     37EXTRA_DIST = autogen.sh $(EMACS)
    3638
    3739
  • Singular/MinorInterface.cc

    r236a4c r3693cf  
    190190  /* before we return the result, let's omit zero generators
    191191     in iii which come after the computed minors */
    192   ideal jjj;
    193   if (collectedMinors == 0) jjj = idInit(1);
    194   else                      jjj = idCopyFirstK(iii, collectedMinors);
    195   idDelete(&iii);
     192  idKeepFirstK(iii, collectedMinors);
    196193  delete[] myColumnIndices;
    197194  delete[] myRowIndices;
    198   return jjj;
     195  return(iii);
    199196}
    200197
     
    542539    else
    543540    { /* k == 0, i.e., all minors are requested */
    544       int minorCount = 1;
    545       for (int i = rowCount - minorSize + 1; i <= rowCount; i++)
    546         minorCount = minorCount * i;
    547       for (int i = 2; i <= minorSize; i++) minorCount = minorCount / i;
    548       for (int i = columnCount - minorSize + 1; i <= columnCount; i++)
    549         minorCount = minorCount * i;
    550       for (int i = 2; i <= minorSize; i++) minorCount = minorCount / i;
    551       /* now: minorCount =   (rowCount over minorSize)
    552                            * (columnCount over minorSize) */
     541      int minorCount = binom(rowCount, minorSize);
     542      minorCount *= binom(columnCount, minorSize);
    553543      if      ((minorSize >= 3) && (vars <= 4)
    554544               && (minorCount >= 100))                           c = true;
  • Tst/New/bigints.res.gz.uu

    rfd60be r3693cf  
    11begin 664 bigints.res.gz
    2 M'XL(")$X(E$``V)I9VEN=',N<F5S`.V8VV[:0!"&[WF*">T%),1A;6-S4*C4
    3 M5JJ0FEXDZ6TJ@S=T%6,;>Z&MJKY[Q]CL#F='*9608B&PUS/_C'<^>Q;?W7\<
    4 M?`$`UH?/@_=0E:DT`C&L]@#WOHE0R%J]5\E^H=^'H1B+4*9&R'\8J?1DY:YP
    5 M-_N@]BT#XB0:P3U/T5D-VP;\5@<M`ZKG^[=J3UF[:)V(<-P%S&OHI3P[T*<[
    6 MA@K.F%$D"1Y<0V?GIKR91;Q;9!^#AK/)D"<0HI*G'3"<UX#JY65_:5!M0"JS
    7 MG&IA7=F9F$H<!;\@7G$W+>V^.*V=8^*,F<SY2$8)S%?=7>U>&&B!.1$@DV)A
    8 M)L+G7@"#%2V+I)*?UU(#+6616;$P_"3R9P&'FU4M,BN%@1:[T6(VTV(VF7H;
    9 M@UQ=058XL1!6B>&(5A+U7F861A+261Q'B>3^F=)PB1[F4]4(M4C8%H;]HPYL
    10 M36X+<\BBP"UF4&O6&[+AQ[T<X]Z3"`*X[54.4%O).:U@D@"C[U[BC23BFDHQ
    11 M@BXT\_$"F^@1YEZ2XCC+QQ?;,(A&3]D=B>-1XB]8!S\F%GKK0NA->)KMRBT2
    12 M)I7X4-E]-P"!><]-<TAAP?,+_`N@]RB<CWE88_5#0CG-+\BD0+A$)@H>AX#D
    13 M4I#,(X!DG@)(K!PO!\V66#RK]@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MI>;1;&`;)XD<2I8<"(U7**'^3050ET2MHMA_\@#
     10M6Y';Q1SR*'"#&;3T=D=T@L0K,/8>>1C"C=<X0&VCX+2!20*,O_NI/Q:(:R;X
     11M&/J@%^,E-O$#+/PTPW&C&%]NHS`>/^9W)([':;!D'8*$6*BM#Y$_95F^*W9(
     12MF%3B0Z/Z;@`"\YZ;YI#"DN=G^)=`[U$XG;"H9;0/"14T/R.3$N$:F4AX'`*2
     13M2T$R7P`D\QA`,NKQ<M!LA<63:G]0=57BS3KV!J1V=F?V_.J]@4D:SZ,`'C@+
     14M`YQ*NQA/4C[E@B\8L)!-&3[H^C`K3DUY5$S.JCS&Z>S>/,N_C>7W43Q)CA.`
     15M2W4C.[IJ&XZQUAW^!1A5_<&`!$],F<@G,:_-#"JP.`H,JLU>&\IV)I(WLJ9V
     16MR$K)L7=S6+)Q-</'Q`:4N&1ZA]M_9K.59])^!72?_U$#VB6`.@10L@QW>F2?
     17M_"5Q=0IQBKF_Q-.T5#X&!`U-UW5V9CHU6V9=\Q5@TN%I/-6.L\)G*XZLN#'8
     18MJ'C'TO'S<G7O6SH$?,)%U@$_"'"E%4=X37+T*+BH-GM]-&UG(F$S*6SC>)J$
     19M[.?+D%:*]YU=K#GKJ&WU3E[9._G]L31/73/P?G?KX5C3>,5>:?XTT&K&6%&U
     20M$4,B9*GNYMJD<Y&W82[I>B[I>B[I>B[I>CWR=Z)G+%]X*4IY)-B$I3LIS2W?
     21M?_UT<B+?=?7,W>X=NU(`J12Q]"<KRAZYO!Y>7O[F-W^[.\]P0KRWC;_,83;Q
     22$)!8`````
    2323`
    2424end
  • Tst/New/bigints.stat

    rfd60be r3693cf  
    1 1 >> tst_memory_0 :: 1361197201:0- spielwiese :spielwiese:version:mandelbrot:100568
    2 1 >> tst_memory_1 :: 1361197201:0- spielwiese :spielwiese:version:mandelbrot:2215936
    3 1 >> tst_memory_2 :: 1361197201:0- spielwiese :spielwiese:version:mandelbrot:2215936
    4 1 >> tst_timer_1 :: 1361197201:0- spielwiese :spielwiese:version:mandelbrot:2
     11 >> tst_memory_0 :: 1361274590:3.1.3.sw $Id$:spielwiese:version:thinktank:97040
     21 >> tst_memory_1 :: 1361274590:3.1.3.sw $Id$:spielwiese:version:thinktank:2236416
     31 >> tst_memory_2 :: 1361274590:3.1.3.sw $Id$:spielwiese:version:thinktank:2236416
     41 >> tst_timer_1 :: 1361274590:3.1.3.sw $Id$:spielwiese:version:thinktank:4
  • kernel/ideals.cc

    r236a4c r3693cf  
    1111
    1212#include <omalloc/omalloc.h>
    13 #include <misc/auxiliary.h>
    14 
    1513
    1614#ifndef NDEBUG
     
    25592557*/
    25602558
    2561 
    2562 
     2559/// keeps the first k (>= 1) entries of the given ideal
     2560/// (Note that the kept polynomials may be zero.)
     2561void idKeepFirstK(ideal id, const int k)
     2562{
     2563   for (int i = IDELEMS(id)-1; i >= k; i--)
     2564   {
     2565      if (id->m[i] != NULL) pDelete(&id->m[i]);
     2566   }
     2567   int kk=k;                                                                                                                 
     2568   if (k==0) kk=1; /* ideals must have at least one element(0)*/                                                             
     2569   pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));                                                                       
     2570   IDELEMS(id) = kk;
     2571}
     2572
     2573/*
     2574* compare the leading terms of a and b
     2575*/
     2576static int tCompare(const poly a, const poly b)
     2577{
     2578  if (b == NULL) return(a != NULL);
     2579  if (a == NULL) return(-1);
     2580
     2581  /* a != NULL && b != NULL */
     2582  int r = pLmCmp(a, b);
     2583  if (r != 0) return(r);
     2584  number h = nSub(pGetCoeff(a), pGetCoeff(b));
     2585  r = -1 + nIsZero(h) + 2*nGreaterZero(h);   /* -1: <, 0:==, 1: > */
     2586  nDelete(&h);
     2587  return(r);
     2588}
     2589
     2590/*
     2591* compare a and b (rev-lex on terms)
     2592*/
     2593static int pCompare(const poly a, const poly b)
     2594{
     2595  int r = tCompare(a, b);
     2596  if (r != 0) return(r);
     2597
     2598  poly aa = a;
     2599  poly bb = b;
     2600  while (r == 0 && aa != NULL && bb != NULL)
     2601  {
     2602    pIter(aa);
     2603    pIter(bb);
     2604    r = tCompare(aa, bb);
     2605  }
     2606  return(r);
     2607}
     2608
     2609typedef struct
     2610{
     2611  poly p;
     2612  int index;
     2613} poly_sort;
     2614
     2615int pCompare_qsort(const void *a, const void *b)
     2616{
     2617  int res = pCompare(((poly_sort *)a)->p, ((poly_sort *)b)->p);
     2618  return(res);
     2619}
     2620
     2621void idSort_qsort(poly_sort *id_sort, int idsize)
     2622{
     2623  qsort(id_sort, idsize, sizeof(poly_sort), pCompare_qsort);
     2624}
     2625
     2626/*2
     2627* ideal id = (id[i])
     2628* if id[i] = id[j] then id[j] is deleted for j > i
     2629*/
     2630void idDelEquals(ideal id)
     2631{
     2632  int idsize = IDELEMS(id);
     2633  poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
     2634  for (int i = 0; i < idsize; i++)
     2635  {
     2636    id_sort[i].p = id->m[i];
     2637    id_sort[i].index = i;
     2638  }
     2639  idSort_qsort(id_sort, idsize);
     2640  int index, index_i, index_j;
     2641  int i = 0;
     2642  for (int j = 1; j < idsize; j++)
     2643  {
     2644    if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
     2645    {
     2646      index_i = id_sort[i].index;
     2647      index_j = id_sort[j].index;
     2648      if (index_j > index_i)
     2649      {
     2650        index = index_j;
     2651      }
     2652      else
     2653      {
     2654        index = index_i;
     2655        i = j;
     2656      }
     2657      pDelete(&id->m[index]);
     2658    }
     2659    else
     2660    {
     2661      i = j;
     2662    }
     2663  }
     2664  omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
     2665}
  • kernel/ideals.h

    r236a4c r3693cf  
    2424}
    2525
     26void idKeepFirstK(ideal ide, const int k);
     27void idDelEquals(ideal id);
     28
    2629/// delete an ideal
    2730inline void idDelete (ideal* h, ring r = currRing)
  • libpolys/coeffs/shortfl.cc

    rfd60be r3693cf  
    66* ABSTRACT:
    77*/
    8 
     8#include <iostream>
    99#include <coeffs/shortfl.h>
    1010
    1111#include <string.h>
     12#include <math.h>
    1213#include <coeffs/coeffs.h>
    1314#include <coeffs/numbers.h>
     
    373374  assume( getCoeffType(r) == ID );
    374375  assume( getCoeffType(aRing) ==  n_Zp );
    375  
     376
    376377  int i = (int)((long)from);
    377378  float f = (float)i;
     
    389390
    390391static number nrMapC(number from, const coeffs aRing, const coeffs r)
    391 { 
     392{
    392393  assume( getCoeffType(r) == ID );
    393394  assume( getCoeffType(aRing) == n_long_C );
    394  
     395
    395396  gmp_float h = ((gmp_complex*)from)->real();
    396397  float t =(float)mpf_get_d((mpf_srcptr)&h);
     
    406407*/
    407408#define SR_HDL(A) ((long)(A))
    408 #define mpz_isNeg(A) ((A)->_mp_size<0)
    409 #define mpz_limb_size(A) ((A)->_mp_size)
    410 #define mpz_limb_d(A) ((A)->_mp_d)
    411 #define MPZ_DIV(A,B,C) mpz_tdiv_q((A),(B),(C))
    412409#define IS_INT(A) ((A)->s==3)
    413410#define IS_IMM(A) (SR_HDL(A)&SR_INT)
    414411#define GET_NOM(A) ((A)->z)
    415412#define GET_DENOM(A) ((A)->n)
    416 #define MPZ_INIT mpz_init
    417 #define MPZ_CLEAR mpz_clear
    418413
    419414  assume( getCoeffType(r) == ID );
    420415  assume( getCoeffType(aRing) == n_Q );
    421 
    422   mpz_t h;
    423   mpz_ptr g,z,n;
    424   int i,j,t,s;
    425   float ba,rr,rn,y;
    426416
    427417  if (IS_IMM(from))
    428418    return nf((float)nlInt(from,NULL /* dummy for nlInt*/)).N();
    429   z=GET_NOM(from);
    430   s=0X10000;
    431   ba=(float)s;
    432   ba*=ba;
    433   rr=0.0;
    434   i=mpz_size1(z);
     419
     420  /* read out the enumerator */
     421  mpz_ptr z=GET_NOM(from);
     422  if(mpz_size1(z)>4)
     423  {
     424    WerrorS("float overflow");
     425    return nf(0.0).N();
     426  }
     427  mpf_t e;
     428  mpf_init(e);
     429  mpf_set_z(e,z);
     430
     431  /* if number was an integer, we are done*/
    435432  if(IS_INT(from))
    436433  {
    437     if(i>4)
    438     {
    439       WerrorS("float overflow");
    440       return nf(rr).N();
    441     }
    442     i--;
    443     rr=(float)mpz_limb_d(z)[i];
    444     while(i>0)
    445     {
    446       i--;
    447       y=(float)mpz_limb_d(z)[i];
    448       rr=rr*ba+y;
    449     }
    450     if(mpz_isNeg(z))
    451       rr=-rr;
    452     return nf(rr).N();
    453   }
    454   n=GET_DENOM(from);
    455   j=s=mpz_limb_size(n);
    456   if(j>i)
    457   {
    458     g=n; n=z; z=g;
    459     t=j; j=i; i=t;
    460   }
    461   t=i-j;
    462   if(t>4)
    463   {
    464     if(j==s)
    465       WerrorS("float overflow");
    466     return nf(rr).N();
    467   }
    468   if(t>1)
    469   {
    470     g=h;
    471     MPZ_INIT(g);
    472     MPZ_DIV(g,z,n);
    473     t=mpz_size1(g);
    474     if(t>4)
    475     {
    476       MPZ_CLEAR(g);
    477       if(j==s)
    478         WerrorS("float overflow");
    479       return nf(rr).N();
    480     }
    481     t--;
    482     rr=(float)mpz_limb_d(g)[t];
    483     while(t)
    484     {
    485       t--;
    486       y=(float)mpz_limb_d(g)[t];
    487       rr=rr*ba+y;
    488     }
    489     MPZ_CLEAR(g);
    490     if(j!=s)
    491       rr=1.0/rr;
    492     if(mpz_isNeg(z))
    493       rr=-rr;
    494     return nf(rr).N();
    495   }
    496   rn=(float)mpz_limb_d(n)[j-1];
    497   rr=(float)mpz_limb_d(z)[i-1];
    498   if(j>1)
    499   {
    500     rn=rn*ba+(float)mpz_limb_d(n)[j-2];
    501     rr=rr*ba+(float)mpz_limb_d(z)[i-2];
    502     i--;
    503   }
    504   if(t!=0)
    505     rr=rr*ba+(float)mpz_limb_d(z)[i-2];
    506   if(j==s)
    507     rr=rr/rn;
    508   else
    509     rr=rn/rr;
    510   if(mpz_isNeg(z))
    511     rr=-rr;
    512   return nf(rr).N();
    513 }
    514 
     434    double basis;
     435    signed long int exp;
     436    basis = mpf_get_d_2exp(&exp, e);
     437    float f = ldexp(basis,exp);
     438    mpf_clear(e);
     439    return nf(f).N();
     440  }
     441
     442  /* else read out the denominator */
     443  mpz_ptr n = GET_DENOM(from);
     444  if(mpz_size1(n)>4)
     445  {
     446    WerrorS("float overflow");
     447    mpf_clear(e);
     448    return nf(0.0).N();
     449  }
     450  mpf_t d;
     451  mpf_init(d);
     452  mpf_set_z(d,n);
     453
     454  /* and compute the quotient */
     455  mpf_t q;
     456  mpf_init(q);
     457  mpf_div(q,e,d);
     458
     459  double basis;
     460  signed long int exp;
     461  basis = mpf_get_d_2exp(&exp, q);
     462  float f = ldexp(basis,exp);
     463  mpf_clear(e);
     464  mpf_clear(d);
     465  mpf_clear(q);
     466  return nf(f).N();
     467}
    515468
    516469nMapFunc nrSetMap(const coeffs src, const coeffs dst)
     
    544497{
    545498  assume( getCoeffType(n) == ID );
    546    
     499
    547500  assume( p == NULL );
    548    
     501
    549502  n->cfKillChar = ndKillChar; /* dummy */
    550503  n->ch = 0;
     
    578531  n->cfDBTest=ndDBTest; // not yet implemented: nrDBTest;
    579532#endif
    580  
     533
    581534  n->nCoeffIsEqual = ndCoeffIsEqual;
    582535
    583536  n->float_len = SHORT_REAL_LENGTH;
    584537  n->float_len2 = SHORT_REAL_LENGTH;
    585    
     538
    586539  // TODO: Any variables?
    587540  return FALSE;
  • libpolys/polys/ext_fields/transext.cc

    r236a4c r3693cf  
    609609  ntTest(b);
    610610  number aNumCoeff = NULL; int aNumDeg = -1;
     611  number aDenCoeff = NULL; int aDenDeg = -1;
    611612  number bNumCoeff = NULL; int bNumDeg = -1;
     613  number bDenCoeff = NULL; int bDenDeg = -1;
    612614  if (!IS0(a))
    613615  {
     
    615617    aNumDeg = p_Totaldegree(NUM(fa), ntRing);
    616618    aNumCoeff = p_GetCoeff(NUM(fa), ntRing);
     619    if (DEN(fa)!=NULL)
     620    {
     621      aDenDeg = p_Totaldegree(DEN(fa), ntRing);
     622      aDenCoeff=p_GetCoeff(DEN(fa),ntRing);
     623    }
    617624  }
    618625  else return !(ntGreaterZero (b,cf));
     
    622629    bNumDeg = p_Totaldegree(NUM(fb), ntRing);
    623630    bNumCoeff = p_GetCoeff(NUM(fb), ntRing);
     631    if (DEN(fb)!=NULL)
     632    {
     633      bDenDeg = p_Totaldegree(DEN(fb), ntRing);
     634      bDenCoeff=p_GetCoeff(DEN(fb),ntRing);
     635    }
    624636  }
    625637  else return ntGreaterZero(a,cf);
    626   if (aNumDeg > bNumDeg) return TRUE;
    627   if (aNumDeg < bNumDeg) return FALSE;
    628   return n_Greater(aNumCoeff, bNumCoeff, ntCoeffs);
     638  if (aNumDeg-aDenDeg > bNumDeg-bDenDeg) return TRUE;
     639  if (aNumDeg-aDenDeg < bNumDeg-bDenDeg) return FALSE;
     640  number aa;
     641  number bb;
     642  if (bDenCoeff==NULL) aa=n_Copy(aNumCoeff,ntRing->cf);
     643  else                 aa=n_Mult(aNumCoeff,bDenCoeff,ntRing->cf);
     644  if (aDenCoeff==NULL) bb=n_Copy(bNumCoeff,ntRing->cf);
     645  else                 bb=n_Mult(bNumCoeff,aDenCoeff,ntRing->cf);
     646  BOOLEAN rr= n_Greater(aa, bb, ntCoeffs);
     647  n_Delete(&aa,ntRing->cf);
     648  n_Delete(&bb,ntRing->cf);
     649  return rr;
    629650}
    630651
  • m4/ax_python_with_version.m4

    r236a4c r3693cf  
    2626    then
    2727        AC_MSG_CHECKING(for --with-python)
    28         AC_ARG_WITH(
     28# @<:@=@<:@embed,@:>@PYTHON@:>@
     29          AC_ARG_WITH(
    2930            python,
    30             AS_HELP_STRING([--with-python@<:@=@<:@embed,@:>@PYTHON@:>@],
     31            AS_HELP_STRING([--with-python],
    3132                [absolute path name of Python executable]
    3233            ),
Note: See TracChangeset for help on using the changeset viewer.