Ticket #11321: lcalc-1.23.p6-p9.diff

File lcalc-1.23.p6-p9.diff, 54.6 KB (added by jdemeyer, 10 years ago)
  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    1212
    1313 * Rishikesh
    1414
    15 == Special Build instructions  ==
    16 
    17 Check if there are any unwanted binary files. 4 were found on
    18 version 1.23, which I removed. (David Kirkby, 27th May 2010).
    19 
    20 ./src/src/.Makefile.old.swp
    21 ./src/src/.Lcommandline.ggo.swp
    22 ./src/include/.Lvalue.h.swp
    23 ./src/include/.Lexplicit_formula.h.swp
    24 
    2515== Upstream contact ==
    2616
    2717Michael Rubinstein <mrubinst@uwaterloo.ca>
    2818
     19Sources: http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/L.html
     20
     21Newer beta version 1.3 (not yet in Sage):
     22http://code.google.com/p/l-calc/
     23
     24== Dependencies ==
     25
     26 * GMP/MPIR
     27 * MPFR
     28 * PARI
     29 * GNU patch
     30
     31== Special Update/Build Instructions ==
     32
     33 * There is some garbage in the upstream sources which should be removed:
     34     src/include/.Lexplicit_formula.h.swp
     35     src/include/.Lvalue.h.swp
     36     src/include/._.DS_Store
     37     src/include/.DS_Store
     38     src/include/Lexplicit_formula.h.swap.crap
     39     src/include/Lvalue.h.bak
     40     src/src/Makefile.old
     41     src/src/.Makefile.old.swp
     42     src/src/._.DS_Store
     43     src/src/.DS_Store
     44     src/src/.Lcommandline.ggo.swp
     45     src/src/libLfunction.a
     46 * We (and apparently also upstream) currently don't build Lcalc's tests
     47   (see Makefile), hence there's no spkg-check.
     48   This might change in newer upstream versions.
     49 * TODO / FIXME:
     50   The (upstream) Makefile uses $(CC) to compile C++ (also using $(CCFLAGS)),
     51   which it defines to 'g++', and hardcodes 'g++' when linking the shared
     52   library. (It should use $(CXX) instead, which might *default* to 'g++'.)
     53
     54== Patches ==
     55
     56 * Makefile.patch:
     57   We change a lot there, since Lcalc doesn't have a 'configure' script,
     58   and hence the Makefile is supposed to be edited to customize Lcalc (build
     59   options, locations of headers and libraries etc.).
     60   Besides that, we
     61   - put CXXFLAGS into Lcalc's "CCFLAGS" used for compiling C++,
     62   - remove some stuff involving LDFLAGS1 and LDFLAGS2, setting just LDFLAGS,
     63   - use $(MAKE) instead of 'make' in the crude build receipts,
     64   - use CXXFLAG64 when linking the shared library.
     65 * Lcommon.h.patch:
     66   Uncomment the definition of lcalc_to_double(const long double& x).
     67   (Necessary for GCC >= 4.6.0, cf. #10892.)
     68   Comment from there:
     69     The reason is the following code horror from src/src/include/Lcommon.h:
     70     [...]
     71     But somebody who is familiar with the codebase should really rewrite lcalc
     72     to not redefine the double() cast, thats just fragile and will sooner or
     73     later again fail inside some system headers.
     74 * pari-2.4.4.patch:
     75   (Patches src/src/Lcommandline.cc and src/src/Lcommandline_elliptic.cc)
     76   Use allocatemem() instead of allocatemoremem() which the new PARI no
     77   longer supports. Also replace lgeti() by (long)cgeti().
     78 * time.h.patch:
     79   (Patches src/include/Lcommandline_numbertheory.h)
     80   Include also <time.h> in Lcommandline_numbertheory.h (at least required
     81   on Cygwin, cf. #9845).
     82   This should get reported upstream.
     83
     84== Changelog ==
     85
     86=== lcalc-1.23.p9 (Jeroen Demeyer, Leif Leonhardy, 6 October 2011) ===
     87 * Trac #11321: Add a patch for PARI-2.4.4 (use allocatemem() instead of
     88   allocatemoremem())
     89 * Remove unused patch Lcommandline_elliptic.cc.cygwin.diff
     90 * Use `patch` for patching instead of `cp`.
     91 * Restore upstream sources (src/src/Makefile was edited) but remove
     92   garbage files mentioned above.
     93 * Remove date from spkg version string
     94 * Various clean-up in spkg-install
     95
    2996=== lcalc-20100428-1.23.p6 (Volker Braun, March 8, 2011) ===
    3097 * upstream commented out lcalc_to_double(long double), but this is
    3198   now required with gcc-4.6. Comment back in!
  • deleted file patches/Lcommandline_elliptic.cc

    diff --git a/patches/Lcommandline_elliptic.cc b/patches/Lcommandline_elliptic.cc
    deleted file mode 100644
    + -  
    1 /*
    2 
    3    Copyright (C) 2001,2002,2003,2004 Michael Rubinstein
    4 
    5    This file is part of the L-function package L.
    6 
    7    This program is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU General Public License
    9    as published by the Free Software Foundation; either version 2
    10    of the License, or (at your option) any later version.
    11 
    12    This program is distributed in the hope that it will be useful,
    13    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15    GNU General Public License for more details.
    16 
    17    Check the License for details. You should have received a copy of it, along
    18    with the package; see the file 'COPYING'. If not, write to the Free Software
    19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    20 
    21 */
    22 
    23 #include "Lcommandline_elliptic.h"
    24 
    25 //returns 0 if initialization goes smoothly, 1 if there's an error
    26 // given the elliptic curve
    27 // y^2 + a1 xy + a3 y = x^3 + a2 x^2 + a4 x + a6
    28 // computes the sign, the conductor, and first N_terms dirichlet coefficients
    29 // of the corresponding L-function. The nth dirichlet coefficient is normalized by
    30 // sqrt(n) so as to have functional equation s <-> 1-s rather than s <-> 2-s
    31 //
    32 
    33 #ifdef INCLUDE_PARI
    34 void initialize_new_L(char *a1, char *a2, char *a3, char *a4, char *a6, int N_terms)
    35 {
    36 
    37     // basic data for the L-function (see the class L_function for full comments)
    38     int what_type;
    39     Long Period;
    40     Double q;
    41     Complex w;
    42     int A;
    43     Double *g;
    44     Complex *l;
    45     int n_poles;
    46     Complex *p;
    47     Complex *r;
    48 
    49     current_L_type=2; //the normalized dirichlet coeffs are real
    50 
    51     what_type=2; //i.e. eliiptic curve L-functions are cusp form L-function
    52 
    53     Period=0;
    54 
    55     A=1;
    56 
    57     //GAMMA factor is GAMMA(s+1/2)
    58     g=new Double[2];
    59     l=new Complex[2];
    60     g[1]=1.;
    61     l[1]=.5;
    62 
    63     Double * coeff;
    64     coeff = new Double[N_terms+1];
    65 
    66     data_E(a1,a2,a3,a4,a6,N_terms,coeff);
    67     //coeff[n], if n > 1, is the nth dirichlet coefficient nomalized by sqrt(n).
    68     //coeff[0] comes back with the sign of the functional equation
    69     //coeff[1] comes back with the conductor of E. We then set it to one.
    70 
    71 
    72     q=sqrt(coeff[1])/(2*Pi);
    73     coeff[1]=1.;
    74 
    75     w=coeff[0];
    76 
    77     n_poles=0; //no poles
    78     p = new Complex[1];
    79     r = new Complex[1];
    80 
    81     Double_L=L_function<Double>("Elliptic curve",what_type,N_terms,coeff,Period,q,w,A,g,l,n_poles,p,r);
    82 
    83     delete [] g;
    84     delete [] l;
    85     delete [] p;
    86     delete [] r;
    87     delete [] coeff;
    88 
    89 
    90 }
    91 
    92 
    93 
    94 
    95 // given the elliptic curve
    96 // y^2 + a1 xy + a3 y = x^3 + a2 x^2 + a4 x + a6
    97 // i.e. computes, the sign, the conductor, and first N_terms dirichlet coefficients
    98 // of the corresponding L-function. The nth dirichlet coefficient is normalized by
    99 // sqrt(n)
    100 void data_E(char *a1, char *a2, char *a3, char *a4, char *a6, int N_terms,Double * coeff)
    101 {
    102 
    103 
    104     int sign; //sign stores the sign of the functional equation
    105     Long p; //denotes a prime
    106     Long m,n;
    107     Double x,r,tmp,tmp2;
    108     Long conductor; //the conductor of the elliptic curve
    109 
    110     GEN y, F, E, C;
    111 
    112 
    113     y = cgeti(64);
    114 
    115     C = cgetg(4, t_VEC);
    116 
    117 
    118     //if a1 etc are integers, we can use gaffsg to
    119     //assign F[1] etc. However, I am treating a1 etc as character
    120     //strings to allow for larger integers, and therefore use gaffect
    121 
    122 
    123     F = cgetg(6, t_VEC);
    124     F[1] = (long)cgeti(BIGDEFAULTPREC);
    125     F[2] = (long)cgeti(BIGDEFAULTPREC);
    126     F[3] = (long)cgeti(BIGDEFAULTPREC);
    127     F[4] = (long)cgeti(BIGDEFAULTPREC);
    128     F[5] = (long)cgeti(BIGDEFAULTPREC);
    129 
    130     //gaffsg(a1,(GEN) F[1]);
    131     //gaffsg(a2,(GEN) F[2]);
    132     //gaffsg(a3,(GEN) F[3]);
    133     //gaffsg(a4,(GEN) F[4]);
    134     //gaffsg(a6,(GEN) F[5]);
    135 
    136     gaffect(strtoGEN(a1), (GEN) F[1]);
    137     gaffect(strtoGEN(a2), (GEN) F[2]);
    138     gaffect(strtoGEN(a3), (GEN) F[3]);
    139     gaffect(strtoGEN(a4), (GEN) F[4]);
    140     gaffect(strtoGEN(a6), (GEN) F[5]);
    141 
    142     E = initell(F,BIGDEFAULTPREC);
    143 
    144     C=globalreduction(E);
    145 
    146     x=gtodouble((GEN) C[1]);
    147 
    148     //if(x<1e18) conductor=(Long) (x+.1);
    149 
    150     if(x<Double(1.*my_LLONG_MAX)) conductor=Long(x+.1);
    151 
    152     else{
    153         cout << "conductor equals " << x << " and is too large" << endl;
    154         exit(1);
    155     }
    156 
    157 
    158     gaffsg(1, (GEN) y);
    159     sign = ellrootno(E,y); //sign of the functional equation
    160 
    161 
    162     for(n=1;n<=N_terms;n++) coeff[n]=1.;
    163 
    164     n=2;
    165     do{
    166         if(isprime(n)){
    167 
    168             p=n;
    169             gaffsg(p,y);
    170             coeff[p] = Double(1.*llrint(gtodouble(apell(E,y))))/sqrt(Double(1.*p));
    171             //coeff[p] = Double(1.*Long(gtodouble(apell(E,y))+.1))/sqrt(Double(1.*p));
    172 
    173             if(gtolong(gmod((GEN) E[12],(GEN) y))==0) // if p|discriminant, i.e. bad reduction
    174             {
    175 
    176                tmp=coeff[p];
    177                r=tmp*tmp;
    178                x=Double(1.*p)*Double(1.*p);
    179                m=Long(x+.1);
    180                if(m<=N_terms)
    181                do{
    182                    coeff[m]=coeff[m]*r;
    183                    x=x*p;
    184                    m=Long(x+.1);
    185                    r=r*tmp;
    186                }while(m<=N_terms);
    187 
    188             }
    189 
    190             else{ // a(p^(j+1)) = a(p)a(p^j) - p a(p^(j-1)) so normalizng by sqrt
    191                   // gives coeff[p^(j+1)] = coeff[p] coeff[p^j]-coeff[p^(j-1)]
    192 
    193                x=Double(1.*p)*Double(1.*p);
    194                m=Long(x+.1);
    195                if(m<=N_terms)
    196                do{
    197                    tmp2=0;
    198                    coeff[m]=coeff[m]*(coeff[p]*coeff[m/p]-coeff[m/(p*p)]);
    199                    x=x*p;
    200                    m=Long(x+.1);
    201                    r=r*tmp;
    202                }while(m<=N_terms);
    203             }
    204         }
    205         else{
    206 
    207             p=1;
    208             do{
    209                 p++;
    210             }while(n%p!=0);
    211 
    212             m=p;
    213             do{
    214                 m=m*p;
    215             }while(n%m==0&&m<n);
    216 
    217             if(n%m!=0) m=m/p;
    218 
    219             coeff[n]=coeff[m]*coeff[n/m];
    220         }
    221 //if(n%10000==1) cout << n << endl;
    222         n++;
    223 
    224     }while(n<=N_terms);
    225 
    226     coeff[0]=1.*sign; coeff[1]=1.*conductor; //the first two spots are used
    227                                        //for the sign and conductor. The rest are
    228                                        //used for the Dirichlet coefficients.
    229 
    230 }
    231 
    232 #endif //ifdef INCLUDE_PARI
    233 
    234 void compute_rank(){
    235     switch(current_L_type)
    236     {
    237         case 1:
    238             int_L.compute_rank(true);
    239             break;
    240         case 2:
    241             Double_L.compute_rank(true);
    242             break;
    243         case 3:
    244             Complex_L.compute_rank(true);
    245             break;
    246     }
    247 }
    248 
    249 void verify_rank(int rank){
    250     switch(current_L_type)
    251     {
    252         case 1:
    253             int_L.verify_rank(rank);
    254             break;
    255         case 2:
    256             Double_L.verify_rank(rank);
    257             break;
    258         case 3:
    259             Complex_L.verify_rank(rank);
    260             break;
    261     }
    262 }
    263 
  • deleted file patches/Lcommandline_elliptic.cc.cygwin

    diff --git a/patches/Lcommandline_elliptic.cc.cygwin b/patches/Lcommandline_elliptic.cc.cygwin
    deleted file mode 100644
    + -  
    1 /*
    2 
    3    Copyright (C) 2001,2002,2003,2004 Michael Rubinstein
    4 
    5    This file is part of the L-function package L.
    6 
    7    This program is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU General Public License
    9    as published by the Free Software Foundation; either version 2
    10    of the License, or (at your option) any later version.
    11 
    12    This program is distributed in the hope that it will be useful,
    13    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15    GNU General Public License for more details.
    16 
    17    Check the License for details. You should have received a copy of it, along
    18    with the package; see the file 'COPYING'. If not, write to the Free Software
    19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    20 
    21 */
    22 
    23 #include "Lcommandline_elliptic.h"
    24 
    25 
    26 //returns 0 if initialization goes smoothly, 1 if there's an error
    27 // given the elliptic curve
    28 // y^2 + a1 xy + a3 y = x^3 + a2 x^2 + a4 x + a6
    29 // i.e. computes, the sign, the conductor, and first N_terms dirichlet coefficients
    30 // of the corresponding L-function. The nth dirichlet coefficient is normalized by
    31 // sqrt(n)
    32 //
    33 
    34 #ifdef INCLUDE_PARI
    35 void initialize_new_L(char *a1, char *a2, char *a3, char *a4, char *a6, int N_terms)
    36 {
    37 
    38     // basic data for the L-function (see the class L_function for full comments)
    39     int what_type;
    40     Long Period;
    41     Double q;
    42     Complex w;
    43     int A;
    44     Double *g;
    45     Complex *l;
    46     int n_poles;
    47     Complex *p;
    48     Complex *r;
    49 
    50     current_L_type=2; //the normalized dirichlet coeffs are real
    51 
    52     what_type=2; //i.e. eliiptic curve L-functions are cusp form L-function
    53 
    54     Period=0;
    55 
    56     A=1;
    57 
    58     //GAMMA factor is GAMMA(s+1/2)
    59     g=new Double[2];
    60     l=new Complex[2];
    61     g[1]=1.;
    62     l[1]=.5;
    63 
    64     Double * coeff;
    65     coeff = new Double[N_terms+1];
    66 
    67     data_E(a1,a2,a3,a4,a6,N_terms,coeff);
    68     //coeff[n], if n > 1, is the nth dirichlet coefficient nomalized by sqrt(n).
    69     //coeff[0] comes back with the sign of the functional equation
    70     //coeff[1] comes back with the conductor of E. We then set it to one.
    71 
    72 
    73     q=sqrt(coeff[1])/(2*Pi);
    74     coeff[1]=1.;
    75 
    76     w=coeff[0];
    77 
    78     n_poles=0; //no poles
    79     p = new Complex[1];
    80     r = new Complex[1];
    81 
    82     Double_L=L_function<Double>("Elliptic curve",what_type,N_terms,coeff,Period,q,w,A,g,l,n_poles,p,r);
    83 
    84     delete [] g;
    85     delete [] l;
    86     delete [] p;
    87     delete [] r;
    88     delete [] coeff;
    89 
    90 
    91 }
    92 
    93 
    94 // SAGE -- used below -- needed for Cygwin.
    95 #ifndef llrint
    96 inline long long int llrint (double x)
    97 {
    98     long long int llrintres;
    99     asm
    100     ("fistpll %0"
    101     : "=m" (llrintres) : "t" (x) : "st");
    102     return llrintres;
    103 }
    104 #endif
    105 
    106 
    107 // given the elliptic curve
    108 // y^2 + a1 xy + a3 y = x^3 + a2 x^2 + a4 x + a6
    109 // i.e. computes, the sign, the conductor, and first N_terms dirichlet coefficients
    110 // of the corresponding L-function. The nth dirichlet coefficient is normalized by
    111 // sqrt(n)
    112 void data_E(char *a1, char *a2, char *a3, char *a4, char *a6, int N_terms,Double * coeff)
    113 {
    114 
    115 
    116     int sign; //sign stores the sign of the functional equation
    117     Long p; //denotes a prime
    118     Long m,n;
    119     Double x,r,tmp,tmp2;
    120     Long conductor; //the conductor of the elliptic curve
    121 
    122     GEN y, F, E, C;
    123 
    124 
    125     y = cgeti(64);
    126 
    127     C = cgetg(4, t_VEC);
    128 
    129 
    130     //if a1 etc are integers, we can use gaffsg to
    131     //assign F[1] etc. However, I am treating a1 etc as character
    132     //strings to allow for larger integers, and therefore use gaffect
    133 
    134 
    135     F = cgetg(6, t_VEC);
    136     F[1] = lgeti(BIGDEFAULTPREC);
    137     F[2] = lgeti(BIGDEFAULTPREC);
    138     F[3] = lgeti(BIGDEFAULTPREC);
    139     F[4] = lgeti(BIGDEFAULTPREC);
    140     F[5] = lgeti(BIGDEFAULTPREC);
    141 
    142     //gaffsg(a1,(GEN) F[1]);
    143     //gaffsg(a2,(GEN) F[2]);
    144     //gaffsg(a3,(GEN) F[3]);
    145     //gaffsg(a4,(GEN) F[4]);
    146     //gaffsg(a6,(GEN) F[5]);
    147 
    148     gaffect(strtoGEN(a1), (GEN) F[1]);
    149     gaffect(strtoGEN(a2), (GEN) F[2]);
    150     gaffect(strtoGEN(a3), (GEN) F[3]);
    151     gaffect(strtoGEN(a4), (GEN) F[4]);
    152     gaffect(strtoGEN(a6), (GEN) F[5]);
    153 
    154     E = initell(F,BIGDEFAULTPREC);
    155 
    156     C=globalreduction(E);
    157 
    158     x=gtodouble((GEN) C[1]);
    159 
    160 
    161     //if(x<1e18) conductor=Long(x+.1);
    162     if(x<Double(1.*my_LLONG_MAX)) conductor=Long(x+.1);
    163 
    164     else{
    165         cout << "conductor equals " << x << " and is too large" << endl;
    166         exit(1);
    167     }
    168 
    169 
    170     gaffsg(1, (GEN) y);
    171     sign = ellrootno(E,y); //sign of the functional equation
    172 
    173 
    174     for(n=1;n<=N_terms;n++) coeff[n]=1.;
    175 
    176     n=2;
    177     do{
    178         if(isprime(n)){
    179 
    180             p=n;
    181             gaffsg(p,y);
    182             coeff[p] = Double(1.*llrint(gtodouble(apell(E,y))))/sqrt(Double(1.*p));
    183             //coeff[p] = Double(1.*Long(gtodouble(apell(E,y))+.1))/sqrt(Double(1.*p));
    184 
    185             if(gtolong(gmod((GEN) E[12],(GEN) y))==0) // if p|discriminant, i.e. bad reduction
    186             {
    187 
    188                tmp=coeff[p];
    189                r=tmp*tmp;
    190                x=Double(1.*p)*Double(1.*p);
    191                m=Long(x+.1);
    192                if(m<=N_terms)
    193                do{
    194                    coeff[m]=coeff[m]*r;
    195                    x=x*p;
    196                    m=Long(x+.1);
    197                    r=r*tmp;
    198                }while(m<=N_terms);
    199 
    200             }
    201 
    202             else{ // a(p^(j+1)) = a(p)a(p^j) - p a(p^(j-1)) so normalizng by sqrt
    203                   // gives coeff[p^(j+1)] = coeff[p] coeff[p^j]-coeff[p^(j-1)]
    204 
    205                x=Double(1.*p)*Double(1.*p);
    206                m=Long(x+.1);
    207                if(m<=N_terms)
    208                do{
    209                    tmp2=0;
    210                    coeff[m]=coeff[m]*(coeff[p]*coeff[m/p]-coeff[m/(p*p)]);
    211                    x=x*p;
    212                    m=Long(x+.1);
    213                    r=r*tmp;
    214                }while(m<=N_terms);
    215             }
    216         }
    217         else{
    218 
    219             p=1;
    220             do{
    221                 p++;
    222             }while(n%p!=0);
    223 
    224             m=p;
    225             do{
    226                 m=m*p;
    227             }while(n%m==0&&m<n);
    228 
    229             if(n%m!=0) m=m/p;
    230 
    231             coeff[n]=coeff[m]*coeff[n/m];
    232         }
    233 //if(n%10000==1) cout << n << endl;
    234         n++;
    235 
    236     }while(n<=N_terms);
    237 
    238     coeff[0]=1.*sign; coeff[1]=1.*conductor; //the first two spots are used
    239                                        //for the sign and conductor. The rest are
    240                                        //used for the Dirichlet coefficients.
    241 
    242 }
    243 
    244 #endif //ifdef INCLUDE_PARI
    245 
    246 void compute_rank(){
    247     switch(current_L_type)
    248     {
    249         case 1:
    250             int_L.compute_rank(true);
    251             break;
    252         case 2:
    253             Double_L.compute_rank(true);
    254             break;
    255         case 3:
    256             Complex_L.compute_rank(true);
    257             break;
    258     }
    259 }
    260 
    261 void verify_rank(int rank){
    262     switch(current_L_type)
    263     {
    264         case 1:
    265             int_L.verify_rank(rank);
    266             break;
    267         case 2:
    268             Double_L.verify_rank(rank);
    269             break;
    270         case 3:
    271             Complex_L.verify_rank(rank);
    272             break;
    273     }
    274 }
    275 
  • deleted file patches/Lcommandline_elliptic.cc.cygwin.diff

    diff --git a/patches/Lcommandline_elliptic.cc.cygwin.diff b/patches/Lcommandline_elliptic.cc.cygwin.diff
    deleted file mode 100644
    + -  
    1 diff patces/Lcommandline_elliptic.cc src/src/Lcommandline_elliptic.cc
    2 94,105d93
    3 < // SAGE -- used below -- needed for Cygwin.
    4 < #ifndef llrint
    5 < inline long long int llrint (double x)
    6 < {
    7 <     long long int llrintres;
    8 <     asm
    9 <     ("fistpll %0"
    10 <     : "=m" (llrintres) : "t" (x) : "st");
    11 <     return llrintres;
    12 < }
    13 < #endif
    14 <
    15 
  • deleted file patches/Lcommandline_elliptic.cc.diff

    diff --git a/patches/Lcommandline_elliptic.cc.diff b/patches/Lcommandline_elliptic.cc.diff
    deleted file mode 100644
    + -  
    1 124,128c124,128
    2 <     F[1] = (long)cgeti(BIGDEFAULTPREC);
    3 <     F[2] = (long)cgeti(BIGDEFAULTPREC);
    4 <     F[3] = (long)cgeti(BIGDEFAULTPREC);
    5 <     F[4] = (long)cgeti(BIGDEFAULTPREC);
    6 <     F[5] = (long)cgeti(BIGDEFAULTPREC);
    7 ---
    8 >     F[1] = lgeti(BIGDEFAULTPREC);
    9 >     F[2] = lgeti(BIGDEFAULTPREC);
    10 >     F[3] = lgeti(BIGDEFAULTPREC);
    11 >     F[4] = lgeti(BIGDEFAULTPREC);
    12 >     F[5] = lgeti(BIGDEFAULTPREC);
  • deleted file patches/Lcommandline_numbertheory.h

    diff --git a/patches/Lcommandline_numbertheory.h b/patches/Lcommandline_numbertheory.h
    deleted file mode 100644
    + -  
    1 /*
    2 
    3    Copyright (C) 2001,2002,2003,2004 Michael Rubinstein
    4 
    5    This file is part of the L-function package L.
    6 
    7    This program is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU General Public License
    9    as published by the Free Software Foundation; either version 2
    10    of the License, or (at your option) any later version.
    11 
    12    This program is distributed in the hope that it will be useful,
    13    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15    GNU General Public License for more details.
    16 
    17    Check the License for details. You should have received a copy of it, along
    18    with the package; see the file 'COPYING'. If not, write to the Free Software
    19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    20 
    21 */
    22 
    23 
    24 #ifndef Lcommandline_numbertheory_H
    25 #define Lcommandline_numbertheory_H
    26 
    27 #include <time.h>
    28 #include <stdlib.h>     //for things like srand
    29 #include <iostream>     //for input and output
    30 #include <iomanip>      //for manipulating output such as setprecision
    31 #include <math.h>
    32 //#include <ctime>
    33 #include <limits.h>     // for INT_MAX
    34 #include "Lglobals.h"
    35 
    36 using namespace std;
    37 
    38 long long nextprime(long long n);
    39 bool issquarefree(long long n);
    40 bool isfunddiscriminant(long long n);
    41 long long nextfunddiscriminant(long long n);
    42 int simplified_jacobi(int n,int m);
    43 int simplified_jacobi(long long n,long long m);
    44 int my_kronecker(int n,int m);
    45 int my_kronecker(long long n, long long m);
    46 Double L_1_chi(long long d);
    47 int class_number(long long d);
    48 void ramanujan_tau(Double *c0, int N_terms);
    49 long long gcd(long long a,long long b);
    50 void factor(long long q, long long **factors);
    51 long long power_mod_q(long long a, long long k,long long q);
    52 int prim_root(long long p, int alpha);
    53 void factor(long long q, long long **factors);
    54 int characters();
    55 
    56 bool isprime(long long n);  //by Kyle Wichert
    57 bool RM(long long a, long long N);  //by Kyle Wichert
    58 long long multmodN(long long a, long long b, long long N);  //by Kyle Wichert
    59 
    60 
    61 template <class ttype>
    62 Complex gauss_sum(ttype *chi,long long r,bool cnj=false)
    63 {
    64     Complex SUM=0;
    65     if(cnj==true)
    66         for(int n=1;n<=r; n++) SUM=SUM+conj(chi[n])*exp(n*2*I*Pi/double(r));
    67     else
    68         for(int n=1;n<=r; n++) SUM=SUM+chi[n]*exp(n*2*I*Pi/double(r));
    69 
    70     return SUM;
    71 }
    72 
    73 
    74 #endif
  • deleted file patches/Lcommon.h

    diff --git a/patches/Lcommon.h b/patches/Lcommon.h
    deleted file mode 100644
    + -  
    1 // When MPFR is enabled and double is passed to a templated function
    2 // The function should use precise(ttype) to make sure calculations run
    3 // within the more precise type
    4 #define precise(T) typename precise<T>::precise_type
    5 template<class T> struct precise { typedef T precise_type; };
    6 template<> struct precise<double> { typedef Double precise_type; };
    7 template<> struct precise<complex<double> > { typedef Complex precise_type; };
    8 #ifdef USE_MPFR
    9 template<> struct precise<long long> { typedef double precise_type; };
    10 #else
    11 template<> struct precise<long long> { typedef long long precise_type; };
    12 #endif
    13 //typedef precise<long long>::precise_type Long;
    14 typedef long long Long;
    15 
    16 
    17 // To aid conversion to int value
    18 inline double lcalc_to_double(const Double& x) {
    19 #ifdef USE_MPFR
    20         return x.get_d();
    21 #else
    22         return x;
    23 #endif
    24 }
    25 #ifdef USE_MPFR
    26 inline double lcalc_to_double(const double& x) { return x; }
    27 #endif
    28 inline double lcalc_to_double(const long double& x) { return x; }
    29 inline double lcalc_to_double(const int& x) { return x; }
    30 inline double lcalc_to_double(const long long& x) { return x; }
    31 inline double lcalc_to_double(const short& x) { return x; }
    32 inline double lcalc_to_double(const char& x) { return x; }
    33 inline double lcalc_to_double(const long int& x) { return x; }
    34 inline double lcalc_to_double(const unsigned int& x) { return x; }
    35 inline double lcalc_to_double(const long unsigned int& x) { return x; }
    36 #define Int(x) (int)(lcalc_to_double(x))
    37 #define Long(x) (Long)(lcalc_to_double(x))
    38 #define double(x) (double)(lcalc_to_double(x))
    39 
    40 template<class T> inline int sn(T x)
    41 {
    42  if (x>=0) return 1;
    43  else return -1;
    44 }
    45 
    46 
    47 const bool outputSeries=true;     // Whether to output the coefficients or just the answer
    48 
    49 // Loop i from m to n
    50 // Useful in tidying up most for loops
    51 #define loop(i,m,n) for(typeof(m) i=(m); i!=(n); i++)
    52 
    53 // A class for calculations involving polynomials of small degree
    54 // Not efficient enough for huge polynomials
    55 //
    56 // Polynomial of fixed degree N-1 with coefficients over T
    57 template<class T=Complex> struct smallPoly {
    58         valarray<T> coeffs;
    59         typedef smallPoly<T> poly;
    60         int N;
    61         T zero;
    62 
    63         smallPoly(int N=0) {
    64                 this->N=N;
    65                 coeffs.resize(N);
    66                 zero=0;
    67         }       
    68 
    69         void resize(int N) {
    70                 coeffs.resize(N);
    71                 loop(i,this->N,N)
    72                         coeffs[i]=zero;
    73                 this->N=N;
    74         }
    75 
    76         // Access a coefficient as a subscript
    77         T& operator[](int n) {
    78                 return (n<0 ? zero : coeffs[n]);
    79         }
    80         const T& operator[](int n) const {
    81                 return (n<0 ? zero : coeffs[n]);
    82         }
    83 
    84         // Multiply two polys together, truncating the result
    85         friend poly operator*(const poly& f, const poly& g) {
    86                 poly result(max(f.N,g.N));
    87                 loop(i,0,f.N) result[i]=0;
    88                 double test;
    89                 loop(i,0,f.N) loop(j,0,result.N-i) {
    90                         result[i+j]+=f[i]*g[j];
    91                 }
    92                 return result;
    93         }
    94 
    95         // Divide (in place) by (x-1/a) = (1-ax)/(-a) with a!=0
    96         void divideSpecial(T a) {
    97                 loop(i,1,N) coeffs[i]+=coeffs[i-1]*a;
    98                 coeffs*= -a;
    99         }
    100 
    101         // Evaluate the polynomial at x
    102         template<class U> U operator()(U x) {
    103                 U sum=coeffs[0];
    104                 U cur=1;
    105 
    106                 loop(i,1,N) {
    107                         cur*=x;
    108                         sum+=coeffs[i]*x;
    109                 }
    110                 return sum;
    111         }
    112 
    113         // Output to stdout
    114         friend ostream& operator<<(ostream& s, const poly p) {
    115                 loop(i,0,p.N) s << (i ? " + " : "") << p[i] << "x^" << i;
    116                 return s;
    117         }
    118        
    119         // Arithmetic
    120         template<class U> poly& operator*=(const U& x) {
    121                 coeffs*=x;
    122                 return *this;
    123         }
    124         template<class U> poly& operator/=(const U& x) {
    125                 coeffs/=x;
    126                 return *this;
    127         }
    128 };
    129 
  • patches/Lcommon.h.patch

    diff --git a/patches/Lcommon.h.patch b/patches/Lcommon.h.patch
    a b  
    1 --- ../src/include/Lcommon.h    2010-01-31 15:16:45.000000000 +0000
    2 +++ Lcommon.h   2011-03-08 21:19:11.849443238 +0000
     1--- src/include/Lcommon.h       2010-01-31 15:16:45.000000000 +0000
     2+++ src/include/Lcommon.h       2011-03-08 21:19:11.849443238 +0000
    33@@ -25,7 +25,7 @@
    44 #ifdef USE_MPFR
    55 inline double lcalc_to_double(const double& x) { return x; }
  • deleted file patches/Makefile

    diff --git a/patches/Makefile b/patches/Makefile
    deleted file mode 100644
    + -  
    1 #
    2 # Makefile for the L-function calculator version 0.2
    3 #
    4 
    5 #todo: set up a configuration file that will detect
    6 #the operating system, whether gmp, or pari are installed and
    7 #the location of all the relevant files,
    8 #the c compiler, that will generate options which are specific to the
    9 #compilers, optimization options depending on the chip, etc
    10 
    11 
    12 # Comment out the following line to remove the use of pari's
    13 # elliptic curve routines. Doing so disables the -e option.
    14 # g++ with -DINCLUDE_PARI sends a #define INCLUDE_PARI to the preprocessor.
    15 
    16 PARI_DEFINE = -DINCLUDE_PARI
    17 #PREPROCESSOR_DEFINE = -DUSE_LONG_DOUBLE
    18 
    19 #OPENMP_FLAG = -fopenmp
    20 
    21 #PREPROCESSOR_DEFINE = -DUSE_MPFR
    22 ifeq ($(PREPROCESSOR_DEFINE),-DUSE_MPFR)
    23   #GMP_FLAGS= -L/usr/local/lib -lmpfrcpp -lgmp -lmpfr
    24   GMP_FLAGS= gmpfrxx.o mpfr_mul_d.o -lmpfr -lgmp -lgmpxx -lm
    25 else
    26   GMP_FLAGS=
    27 endif
    28 
    29 
    30 OS_NAME := $(shell uname)
    31 
    32 CC = g++
    33 #cc = /home/mrubinst/local/bin/gcc
    34 #CC = /home/mrubinst/local/bin/g++
    35 #LD = /home/mrubinst/local/bin/g++
    36 
    37 #CC = /Users/michaelrubinstein/math/L/packages/gcc4.3/usr/local/bin/g++
    38 #EXTRA= -pg
    39 #EXTRA = -ftree-vectorize -ftree-vectorizer-verbose=5 -funroll-loops
    40 
    41 
    42 
    43 #MACHINE_SPECIFIC_FLAGS = -Wno-long-double
    44 MACHINE_SPECIFIC_FLAGS = -ffast-math -fPIC
    45 
    46 #G4 = FALSE
    47 #ifeq ($(G4),TRUE)
    48 #MACHINE_SPECIFIC_FLAGS = -fast -mcpu=G4 -mtune=G4
    49 #endif
    50 
    51 #G5 = TRUE
    52 ifeq ($(G5),TRUE)
    53    #MACHINE_SPECIFIC_FLAGS = -fast -mcpu=G5 -mtune=G5
    54    #MACHINE_SPECIFIC_FLAGS = -ffast-math -maltivec -mpowerpc -mpowerpc64 -ftree-vectorize -ftree-vectorizer-verbose=5 -funroll-loops
    55 
    56    #MACHINE_SPECIFIC_FLAGS = -ffast-math -mpowerpc -mpowerpc64 -ftree-vectorize -ftree-vectorizer-verbose=5 -funroll-loops
    57    MACHINE_SPECIFIC_FLAGS = -ffast-math -mpowerpc -mpowerpc64 -m64
    58    #MACHINE_SPECIFIC_FLAGS = -mpowerpc -mpowerpc64 -m64
    59 endif
    60 
    61 CCFLAGS =  $(CXXFLAGS) -O3  $(OPENMP_FLAG)  $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
    62 
    63 #warning- O2 doesn't help with -DUSE_LONG_DOUBLE on mac, and actually seems to hurt, making runtime longer
    64 #by a factor of 1.5
    65 
    66 
    67 ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
    68     #location of pari.h.
    69     LOCATION_PARI_H = $(SAGE_LOCAL)/include/pari #usual location
    70 
    71     #location of libpari.a or of libpari.so
    72     #depending on whether static or dynamic libraries are being used.
    73     #On mac os x it's the former, on linux I think usually the latter.
    74     LOCATION_PARI_LIBRARY = $(SAGE_LOCAL)/lib #usual location
    75 else
    76     #supplied as a dummy so as to avoid more ifeq's below
    77     LOCATION_PARI_H = .
    78     LOCATION_PARI_LIBRARY = .
    79 endif
    80 
    81 
    82 
    83 #INCLUDEFILES= -I../include -I../../packages/gcc4.3/usr/local/include
    84 INCLUDEFILES= -I../include
    85 
    86 #For Mac os x we omit shared library options
    87 
    88 ifeq ($(OS_NAME),Darwin)
    89     DYN_OPTION=dynamiclib
    90 else
    91     DYN_OPTION=shared
    92 endif
    93 
    94 LDFLAGS = -L$(LOCATION_PARI_LIBRARY) -lpari -lmpir
    95 
    96 
    97 
    98 #NOTES:
    99 #for caedmon: the shared pari library is in a funny location: /usr/local/pari/pari-2.1.5/lib
    100 #At compile time we need to specify that location with:
    101 #    -L/usr/local/pari/pari-2.1.5/lib -lpari
    102 #At runtime, the computer attempts to load the pari shared library, and if it isn't in a standard
    103 #location, we can do two things.
    104 #1) One page suggested:
    105 #    -Xlinker -rpath -Xlinker /usr/local/pari/pari-2.1.5/lib
    106 #2) The other option, not recommended, is to type at the unix prompt:
    107 #    LD_LIBRARY_PATH=/usr/local/pari/pari-2.1.5/lib:$LD_LIBRARY_PATH
    108 #    export LD_LIBRARY_PATH
    109 #If this is not done correctly, at runntime one gets the error
    110 #    ./lcalc: error while loading shared libraries: libpari.so.1: cannot open shared
    111 #    object file: No such file or directory
    112 #One can list, after compiling, dynamic dependencies with the command: ldd lcalc and it will
    113 #become clear which libraries the computer can find.
    114 
    115 
    116 INSTALL_DIR= /usr/local
    117 
    118 #object files for the libLfunction library
    119 OBJ_L = Lglobals.o Lgamma.o Lriemannsiegel.o Lriemannsiegel_blfi.o Ldokchitser.o
    120 
    121 #object files for the command line program
    122 OBJ2=$(OBJ_L) Lcommandline_globals.o Lcommandline_misc.o Lcommandline_numbertheory.o Lcommandline_values_zeros.o
    123 OBJ3=$(OBJ2) Lcommandline_elliptic.o Lcommandline_twist.o Lcommandline.o cmdline.o
    124 OBJECTS = $(OBJ3)
    125 
    126 all:
    127 #       $(MAKE) print_vars
    128         $(MAKE) libLfunction.so
    129         $(MAKE) lcalc
    130         $(MAKE) examples
    131 #       $(MAKE) find_L
    132 #       $(MAKE) test
    133 
    134 print_vars:
    135         @echo OS_NAME = $(OS_NAME)
    136 
    137 lcalc: $(OBJECTS)
    138         $(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(LDFLAGS) -o lcalc $(GMP_FLAGS)
    139 
    140 examples:
    141         $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/example.cc libLfunction.so -o example_programs/example $(GMP_FLAGS)
    142 
    143 
    144 proc:
    145         $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/proc.cc libLfunction.so -o example_programs/proc $(GMP_FLAGS)
    146 
    147 test:
    148         $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/test.cc libLfunction.so -o example_programs/test $(GMP_FLAGS)
    149 
    150 find_L:
    151         $(CC) $(CCFLAGS) $(INCLUDEFILES) find_L_functions/find_L_functions.cc libLfunction.so -o find_L_functions/find_L $(GMP_FLAGS)
    152 
    153 .cc.o:
    154         $(CC) $(CCFLAGS) $(INCLUDEFILES) -c $<
    155 .c.o:
    156         $(CC) $(CCFLAGS) $(INCLUDEFILES) -c $<
    157 
    158 
    159 Lglobals.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    160 
    161 #Lmisc.o: ../include/Lmisc.h ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    162 
    163 Lgamma.o: ../include/Lgamma.h ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    164 
    165 Lriemannsiegel.o: ../include/Lriemannsiegel.h ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h
    166 Lriemannsiegel.o: ../include/Lint_complex.h ../include/Lgamma.h
    167 Lriemannsiegel.o: ../include/Lmisc.h
    168 
    169 Ldokchitser.o: ../include/Ldokchitser.h ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    170 
    171 #all I need here is dependence on the definition of the L-function class
    172 #and the Complex typedef
    173 Lcommandline_globals.o: ../include/Lcommandline_globals.h ../include/L.h
    174 Lcommandline_globals.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    175 #Lcommandline_globals.o: ../include/Lmisc.h ../include/Lgamma.h
    176 #Lcommandline_globals.o: ../include/Lriemannsiegel.h
    177 #Lcommandline_globals.o: ../include/Ldirichlet_series.h ../include/Lprint.h
    178 #Lcommandline_globals.o: ../include/Lnumberzeros.h ../include/Lgram.h
    179 #Lcommandline_globals.o: ../include/Lvalue.h ../include/Lfind_zeros.h
    180 
    181 Lcommandline_misc.o: ../include/Lcommandline_misc.h ../include/L.h
    182 Lcommandline_misc.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    183 Lcommandline_misc.o: ../include/Lmisc.h ../include/Lgamma.h
    184 Lcommandline_misc.o: ../include/Lriemannsiegel.h
    185 Lcommandline_misc.o: ../include/Ldirichlet_series.h ../include/Lprint.h
    186 Lcommandline_misc.o: ../include/Lnumberzeros.h ../include/Lgram.h
    187 Lcommandline_misc.o: ../include/Lvalue.h ../include/Lfind_zeros.h
    188 Lcommandline_misc.o: ../include/Lcommandline_numbertheory.h
    189 Lcommandline_misc.o: ../include/Lcommandline_globals.h
    190 
    191 Lcommandline_numbertheory.o: ../include/Lcommandline_numbertheory.h
    192 Lcommandline_numbertheory.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    193 
    194 Lcommandline_values_zeros.o: ../include/Lcommandline_values_zeros.h
    195 Lcommandline_values_zeros.o: ../include/L.h ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h
    196 Lcommandline_values_zeros.o: ../include/Lint_complex.h ../include/Lmisc.h
    197 Lcommandline_values_zeros.o: ../include/Lgamma.h ../include/Lriemannsiegel.h
    198 Lcommandline_values_zeros.o: ../include/Ldirichlet_series.h
    199 Lcommandline_values_zeros.o: ../include/Lprint.h ../include/Lnumberzeros.h
    200 Lcommandline_values_zeros.o: ../include/Lgram.h ../include/Lvalue.h
    201 Lcommandline_values_zeros.o: ../include/Lfind_zeros.h
    202 Lcommandline_values_zeros.o: ../include/Lcommandline_numbertheory.h
    203 Lcommandline_values_zeros.o: ../include/Lcommandline_globals.h
    204 
    205 Lcommandline_elliptic.o: ../include/Lcommandline_elliptic.h ../include/L.h
    206 Lcommandline_elliptic.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    207 #Lcommandline_elliptic.o: ../include/Lmisc.h ../include/Lgamma.h
    208 Lcommandline_elliptic.o: ../include/Lriemannsiegel.h
    209 Lcommandline_elliptic.o: ../include/Ldirichlet_series.h ../include/Lprint.h
    210 Lcommandline_elliptic.o: ../include/Lnumberzeros.h ../include/Lgram.h
    211 Lcommandline_elliptic.o: ../include/Lvalue.h ../include/Lfind_zeros.h
    212 Lcommandline_elliptic.o: ../include/Lcommandline_numbertheory.h
    213 Lcommandline_elliptic.o: ../include/Lcommandline_globals.h
    214         $(CC) $(CCFLAGS) $(INCLUDEFILES) -I$(LOCATION_PARI_H) $(PARI_DEFINE) -c Lcommandline_elliptic.cc
    215 
    216 Lcommandline_twist.o: ../include/Lcommandline_twist.h ../include/L.h
    217 Lcommandline_twist.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    218 #Lcommandline_twist.o: ../include/Lmisc.h ../include/Lgamma.h
    219 Lcommandline_twist.o: ../include/Lriemannsiegel.h
    220 Lcommandline_twist.o: ../include/Ldirichlet_series.h ../include/Lprint.h
    221 Lcommandline_twist.o: ../include/Lnumberzeros.h ../include/Lgram.h
    222 Lcommandline_twist.o: ../include/Lvalue.h ../include/Lfind_zeros.h
    223 Lcommandline_twist.o: ../include/Lcommandline_numbertheory.h
    224 Lcommandline_twist.o: ../include/Lcommandline_globals.h
    225 Lcommandline_twist.o: ../include/Lcommandline_elliptic.h
    226         $(CC) $(CCFLAGS) $(INCLUDEFILES) -I$(LOCATION_PARI_H) $(PARI_DEFINE) -c Lcommandline_twist.cc
    227 
    228 cmdline.o: ../include/cmdline.h ../include/getopt.h
    229 #$(CC) $(CCFLAGS) $(INCLUDEFILES) -DHAVE_LONG_LONG -c cmdline.c
    230 
    231 
    232 Lcommandline.o: ../include/Lcommandline.h ../include/L.h
    233 Lcommandline.o: ../include/Lglobals.h ../include/Lcommon.h ../include/Lcomplex.h ../include/Lnumeric.h ../include/Lint_complex.h
    234 Lcommandline.o: ../include/Lmisc.h ../include/Lgamma.h
    235 Lcommandline.o: ../include/Lriemannsiegel.h ../include/Ldirichlet_series.h
    236 Lcommandline.o: ../include/Lprint.h ../include/Lnumberzeros.h
    237 Lcommandline.o: ../include/Lgram.h ../include/Lvalue.h
    238 Lcommandline.o: ../include/Lfind_zeros.h
    239 Lcommandline.o: ../include/Lcommandline_numbertheory.h
    240 Lcommandline.o: ../include/Lcommandline_globals.h
    241 Lcommandline.o: ../include/Lcommandline_misc.h
    242 Lcommandline.o: ../include/Lcommandline_elliptic.h
    243 Lcommandline.o: ../include/Lcommandline_twist.h
    244 Lcommandline.o: ../include/Lcommandline_values_zeros.h
    245         $(CC) $(CCFLAGS) $(INCLUDEFILES) -I$(LOCATION_PARI_H) $(PARI_DEFINE) -c Lcommandline.cc
    246 
    247 
    248 libLfunction.so: $(OBJ_L)
    249         g++ -$(DYN_OPTION) ${CXXFLAG64} -o libLfunction.so $(OBJ_L)
    250 
    251 clean:
    252         rm -f *.o lcalc libLfunction.so example_programs/example
    253 
    254 install:
    255         cp -f lcalc $(INSTALL_DIR)/bin/.
    256         cp -f libLfunction.so $(INSTALL_DIR)/lib/.
    257         cp -rf ../include $(INSTALL_DIR)/include/Lfunction
    258 
    259 
    260 SRCS = Lcommandline.cc Lcommandline_elliptic.cc Lcommandline_globals.cc Lcommandline_misc.cc Lcommandline_numbertheory.cc Lcommandline_twist.cc Lcommandline_values_zeros.cc Lgamma.cc Lglobals.cc Lmisc.cc Lriemannsiegel.cc Lriemannsiegel_blfi.cc cmdline.c
    261 depend:
    262         makedepend -f depends -- $(CCFLAGS) -Y../include -- $(SRCS)
  • (a) a/patches/Makefile.diff vs. (b) b/patches/Makefile.patch

    diff --git a/patches/Makefile.diff b/patches/Makefile.patch
    rename from patches/Makefile.diff
    rename to patches/Makefile.patch
    a b  
    1 --- ../src/src/Makefile 2010-01-31 16:16:45.000000000 +0100
    2 +++ Makefile    2010-09-19 18:24:23.059332566 +0200
     1--- src/src/Makefile    2010-01-31 16:16:45.000000000 +0100
     2+++ src/src/Makefile    2010-09-19 18:24:23.059332566 +0200
     3@@ -13,7 +13,7 @@
     4 # elliptic curve routines. Doing so disables the -e option.
     5 # g++ with -DINCLUDE_PARI sends a #define INCLUDE_PARI to the preprocessor.
     6
     7-#PARI_DEFINE = -DINCLUDE_PARI
     8+PARI_DEFINE = -DINCLUDE_PARI
     9 #PREPROCESSOR_DEFINE = -DUSE_LONG_DOUBLE
     10
     11 #OPENMP_FLAG = -fopenmp
    312@@ -58,9 +58,7 @@
    413    #MACHINE_SPECIFIC_FLAGS = -mpowerpc -mpowerpc64 -m64
    514 endif
     
    1625 ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
    1726     #location of pari.h.
    1827-    LOCATION_PARI_H = /usr/local/include/pari #usual location
    19 +    LOCATION_PARI_H = $(SAGE_LOCAL)/include/pari #usual location
     28+    LOCATION_PARI_H = $(SAGE_LOCAL)/include/pari
    2029 
    2130     #location of libpari.a or of libpari.so
    2231     #depending on whether static or dynamic libraries are being used.
    2332     #On mac os x it's the former, on linux I think usually the latter.
    2433-    LOCATION_PARI_LIBRARY = /usr/local/lib #usual location
    25 +    LOCATION_PARI_LIBRARY = $(SAGE_LOCAL)/lib #usual location
     34+    LOCATION_PARI_LIBRARY = $(SAGE_LOCAL)/lib
    2635 else
    2736     #supplied as a dummy so as to avoid more ifeq's below
    2837     LOCATION_PARI_H = .
     
    5059-else
    5160-    LDFLAGS = $(LDFLAGS2)
    5261-endif
    53 +LDFLAGS = -L$(LOCATION_PARI_LIBRARY) -lpari -lmpir
     62+LDFLAGS = -L$(LOCATION_PARI_LIBRARY) -lpari -lgmp
    5463 
    5564 
    5665 
     
    7887 
    7988 libLfunction.so: $(OBJ_L)
    8089-       g++ -$(DYN_OPTION)  -o libLfunction.so $(OBJ_L)
    81 +       g++ -$(DYN_OPTION) ${CXXFLAG64} -o libLfunction.so $(OBJ_L)
     90+       g++ -$(DYN_OPTION) $(CXXFLAG64) -o libLfunction.so $(OBJ_L)
    8291 
    8392 clean:
    8493        rm -f *.o lcalc libLfunction.so example_programs/example
  • new file patches/pari-2.4.4.patch

    diff --git a/patches/pari-2.4.4.patch b/patches/pari-2.4.4.patch
    new file mode 100644
    - +  
     1--- src/src/Lcommandline.cc     2010-01-31 16:16:45.000000000 +0100
     2+++ src/src/Lcommandline.cc     2011-05-10 17:22:10.000000000 +0200
     3@@ -31,6 +31,12 @@
     4 #include "Lcommandline.h"
     5 #include "cmdline.h"
     6 
     7+/* No-operation error recovery routine for PARI.  This is needed for
     8+ * allocatemem(), which calls the error recovery routine (because
     9+ * allocatemem() destroys the PARI stack).
     10+ */
     11+void pari_err_recover_nop(long errnum) {return;}
     12+
     13 int main (int argc, char *argv[])
     14 {
     15 
     16@@ -473,7 +479,13 @@
     17 
     18 #ifdef INCLUDE_PARI
     19         if(do_elliptic_curve){
     20-             allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
     21+             /* allocatemem() calls the callback function cb_pari_err_recover(),
     22+              * which we temporarily change to do nothing. */
     23+             void (*saved_err_recover)(long) = cb_pari_err_recover;
     24+             cb_pari_err_recover = pari_err_recover_nop;
     25+             allocatemem(N_terms*16 + 1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
     26+             cb_pari_err_recover = saved_err_recover;
     27+
     28              if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl;
     29              initialize_new_L(a1,a2,a3,a4,a6,N_terms);
     30         }
     31--- src/src/Lcommandline_elliptic.cc    2010-01-31 16:16:45.000000000 +0100
     32+++ src/src/Lcommandline_elliptic.cc    2011-05-10 17:08:10.000000000 +0200
     33@@ -121,11 +121,11 @@
     34 
     35 
     36     F = cgetg(6, t_VEC);
     37-    F[1] = lgeti(BIGDEFAULTPREC);
     38-    F[2] = lgeti(BIGDEFAULTPREC);
     39-    F[3] = lgeti(BIGDEFAULTPREC);
     40-    F[4] = lgeti(BIGDEFAULTPREC);
     41-    F[5] = lgeti(BIGDEFAULTPREC);
     42+    F[1] = (long)cgeti(BIGDEFAULTPREC);
     43+    F[2] = (long)cgeti(BIGDEFAULTPREC);
     44+    F[3] = (long)cgeti(BIGDEFAULTPREC);
     45+    F[4] = (long)cgeti(BIGDEFAULTPREC);
     46+    F[5] = (long)cgeti(BIGDEFAULTPREC);
     47 
     48     //gaffsg(a1,(GEN) F[1]);
     49     //gaffsg(a2,(GEN) F[2]);
  • (a) a/patches/Lcommandline_numbertheory.h.diff vs. (b) b/patches/time.h.patch

    diff --git a/patches/Lcommandline_numbertheory.h.diff b/patches/time.h.patch
    rename from patches/Lcommandline_numbertheory.h.diff
    rename to patches/time.h.patch
    a b  
    1 --- ../src/include/Lcommandline_numbertheory.h  2010-01-31 07:16:45.000000000 -0800
    2 +++ Lcommandline_numbertheory.h 2010-08-31 18:53:18.000000000 -0700
     1--- src/include/Lcommandline_numbertheory.h     2010-01-31 07:16:45.000000000 -0800
     2+++ src/include/Lcommandline_numbertheory.h     2010-08-31 18:53:18.000000000 -0700
    33@@ -24,6 +24,7 @@
    44 #ifndef Lcommandline_numbertheory_H
    55 #define Lcommandline_numbertheory_H
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    11#!/usr/bin/env bash
    22
    3 if [ -z "$SAGE_LOCAL" ] ; then
    4   echo "SAGE_LOCAL undefined ... exiting";
    5   echo "Maybe run 'sage -sh'?"
    6   exit 1
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo >&2 "Error: SAGE_LOCAL undefined ... exiting"
     5    echo >&2 "Maybe run 'sage -sh'?"
     6    exit 1
    77fi
    88
    99# Add a sensible default optimisation flag. Change if necessary.
    1010OPTIMIZATION_FLAGS="-O3"
    1111
    12 # Most packages do not need all these set
    13 # But it is better to do them all each time, rather than ommit
    14 # a flag by mistake.
     12# Most packages do not need all these set, but it is better to do them all
     13# each time, rather than omit a flag by mistake:
    1514
    16 CFLAGS="$CFLAGS $OPTIMIZATION_FLAGS "
    17 CXXFLAGS="$CXXFLAGS $OPTIMIZATION_FLAGS "
    18 FCFLAGS="$FCFLAGS $OPTIMIZATION_FLAGS "
    19 F77FLAGS="$F77FLAGS $OPTIMIZATION_FLAGS "
    20 CPPFLAGS="$CPPFLAGS -I$SAGE_LOCAL/include"
    21 LDFLAGS="$LDFLAGS -L$SAGE_LOCAL/lib"
     15CFLAGS="$OPTIMIZATION_FLAGS $CFLAGS"
     16CXXFLAGS="$OPTIMIZATION_FLAGS $CXXFLAGS"
     17FCFLAGS="$OPTIMIZATION_FLAGS $FCFLAGS"
     18F77FLAGS="$OPTIMIZATION_FLAGS $F77FLAGS"
     19CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"
     20LDFLAGS="-L$SAGE_LOCAL/lib $LDFLAGS"
    2221
    2322
    24 # Compile for 64-bit if SAGE64 is set to 'yes' 
    25 if [ "x$SAGE64" = xyes ]  ; then
    26    echo "Building a 64-bit version of lcalc"
     23# Compile for 64-bit if SAGE64 is set to 'yes':
     24if [ "x$SAGE64" = xyes ]; then
     25    echo >&2 "Building a 64-bit version of lcalc"
    2726
    28    # Both Sun and GNU compilers use -m64 to build 64-bit code,
    29    # but compilers from IBM (on AIX), and HP (on HP-UX)
    30    # do not. So allow the environment
    31    # variables CFLAG64 and CXXFLAG64 to set the flag to whatever
    32    # option the C and C++ compilers want for 64-bit code. If not default to -m64.
     27    # Both Sun and GNU compilers use -m64 to build 64-bit code, but compilers
     28    # from IBM (on AIX), and HP (on HP-UX) do not. So allow the environment
     29    # variables CFLAG64 and CXXFLAG64 to set the flag to whatever option the
     30    # C and C++ compilers want for 64-bit code. If not set, default to -m64.
    3331
    34    if [ -z "$CFLAG64" ] ; then
    35       CFLAG64=-m64
    36    fi
     32    if [ -z "$CFLAG64" ]; then
     33        CFLAG64=-m64
     34    fi
     35    if [ -z "$CXXFLAG64" ]; then
     36        CXXFLAG64="$CFLAG64" # default to that of the C compiler
     37    fi
     38    export CFLAG64
     39    export CXXFLAG64
    3740
    38    if [ -z "$CXXFLAG64" ] ; then
    39       CXXFLAG64=-m64
    40    fi
    41    export CFLAG64
    42    export CXXFLAG64
    43 
    44    CFLAGS="$CFLAGS $CFLAG64 "
    45    CXXFLAGS="$CXXFLAGS $CXXFLAG64 "
    46    FCFLAGS="$FCFLAGS $CXXFLAG64 "
    47    F77FLAGS="$F77FLAGS $CXXFLAG64 "
    48    # Some packages may need LDFLAGS and/or ABI set here.
    49    # LDFLAGS="$LDFLAGS -m64 "
    50    # ABI=64
    51    # Normally one would just add this to CXXFLAGS, but since the Makefile
    52    # does not import CXXFLAGS properly, and it would take a major change to
    53    # sort out the Makefile properly, the variable can just be added here,
    54    # and ${CXXFLAG64} added at the right point in the Makefile for 64-bit builds.
     41    CFLAGS="$CFLAGS $CFLAG64"
     42    CXXFLAGS="$CXXFLAGS $CXXFLAG64"
     43    FCFLAGS="$FCFLAGS $CXXFLAG64" # XXX Does this make sense?
     44    F77FLAGS="$F77FLAGS $CXXFLAG64"
     45    # Some packages may need LDFLAGS and/or ABI set here.
     46    # LDFLAGS="$LDFLAGS $CFLAG64" # XXX Perhaps should use some LDFLAG64.
     47    # ABI=64
     48    # Normally one would just add this to CXXFLAGS, but since the Makefile
     49    # does not import CXXFLAGS properly, and it would take a major change to
     50    # sort out the Makefile properly, the variable can just be added here,
     51    # and ${CXXFLAG64} added at the right point in the Makefile for 64-bit
     52    # builds.
     53    # (The last sentence apparently refers to CXXFLAG64 only. -leif)
    5554fi
    5655
    57 # If SAGE_DEBUG is set either unset (the default), or set to  'yes'
    58 # Add debugging information.
    59 # Since both the Sun and GNU compilers accept -g to give debugging information
     56# If SAGE_DEBUG is set to 'yes', add debugging information.  Since both
     57# the Sun and GNU compilers accept -g to give debugging information,
    6058# there is no need to do anything specific to one compiler or the other.
    6159
    62 if [ "x$SAGE_DEBUG" = xyes ] ; then
    63    echo "Code will be built with debugging information present. Set 'SAGE_DEBUG' to 'no' if you don't want that."
    64    # Actually anything othe than 'yes' will cause
    65    # no debugging information to be added.
    66    CFLAGS="$CFLAGS -g "
    67    CXXFLAGS="$CXXFLAGS -g "
    68    FCFLAGS="$FCFLAGS -g "
    69    F77FLAGS="$F77FLAGS -g "
     60if [ "x$SAGE_DEBUG" = xyes ]; then
     61    echo >&2 "Code will be built with debugging information present. Unset 'SAGE_DEBUG'"
     62    echo >&2 "or set it to 'no' if you don't want that."
     63
     64    CFLAGS="$CFLAGS -g"
     65    CXXFLAGS="$CXXFLAGS -g"
     66    FCFLAGS="$FCFLAGS -g"
     67    F77FLAGS="$F77FLAGS -g"
    7068else
    71    echo "No debugging information will be used during the build of this package"
    72    echo "Set SAGE_DEBUG to yes if you want debugging information present (-g added)"
     69    echo >&2 "No debugging information will be used during the build of this package."
     70    echo >&2 "Set 'SAGE_DEBUG' to 'yes' if you want debugging information present (-g added)."
    7371fi
    7472
    7573# Add appropriate flag(s) to show all warnings.
    76 # This test of a compiler is not perfect by any means, but
    77 # is better than nothing.
     74# This test of a compiler is not perfect by any means, but is better than
     75# nothing:
    7876
    79 if "$CC" -flags > /dev/null 2>&1 ; then
    80    SUN_COMPILER=1
    81    # The Sun compilers are fussy, and adding extra
    82    # warnings will just show too many.
     77if $CC -flags >/dev/null 2>&1; then
     78    SUN_COMPILER=1
     79    # The Sun compilers are fussy, and adding extra
     80    # warnings will just show too many.
    8381else
    84    # Assume gcc if not the Sun C compiler.
    85    # Add -Wall to show all warnings.
    86    CFLAGS="$CFLAGS -Wall "
    87    CXXFLAGS="$CXXFLAGS -Wall "
    88    FCFLAGS="$FCFLAGS -Wall "
    89    F77FLAGS="$F77FLAGS -Wall "
    90    GNU_COMPILER=1
     82    # Assume gcc if not the Sun C compiler.
     83    GNU_COMPILER=1
     84    # Add -Wall to show all warnings.
     85    CFLAGS="-Wall $CFLAGS"
     86    CXXFLAGS="-Wall $CXXFLAGS"
     87    FCFLAGS="-Wall $FCFLAGS"
     88    F77FLAGS="-Wall $F77FLAGS"
    9189fi
    9290
    93 # Determine if the C++ compiler is the Sun or GNU compiler
    94 # Just to check we are not mising GNU and non-GNU.
    95 if "$CXX" -flags > /dev/null 2>&1 ; then
    96    SUN_COMPILER=1
     91# Determine if the C++ compiler is the Sun or GNU compiler,
     92# just to check we are not mixing GNU and non-GNU:
     93if $CXX -flags >/dev/null 2>&1; then
     94    SUN_COMPILER=1
    9795else
    98    GNU_COMPILER=1
     96    # Assume gcc/g++ if not the Sun C++ compiler.
     97    GNU_COMPILER=1
    9998fi
    10099
    101 # Determine if the Fortran compiler is the Sun or GNU compiler
    102 if [ -z "$SAGE_FORTRAN" ] ; then
    103    echo "No Fortran compiler has been defined. This is not normally a problem."
     100# Determine if the Fortran compiler is the Sun or GNU compiler:
     101if [ -z "$SAGE_FORTRAN" ]; then
     102    echo >&2 "No Fortran compiler has been defined. This is not normally a problem."
    104103else
    105    if "$SAGE_FORTRAN" -flags > /dev/null 2>&1 ; then
    106       SUN_COMPILER=1
    107    else
    108       GNU_COMPILER=1
    109    fi
     104    if $SAGE_FORTRAN -flags >/dev/null 2>&1; then
     105        SUN_COMPILER=1
     106    else
     107        GNU_COMPILER=1
     108    fi
    110109fi
    111110
    112 
    113 # Check if SAGE_FORTRAN_LIB is defined, that the file actually exists.
    114 # SAGE_FORTRAN_LIB does not always need to be defined, but if it is defined, then
    115 # the file should exist.
    116 if [ -n "$SAGE_FORTRAN_LIB" ] &&  [ ! -e "$SAGE_FORTRAN_LIB" ]; then
    117    echo "SAGE_FORTRAN_LIB is defined as $SAGE_FORTRAN_LIB, but does not exist"
    118    exit 1
     111# Check if SAGE_FORTRAN_LIB is defined, that the file actually exists.
     112# SAGE_FORTRAN_LIB does not always need to be defined, but if it is defined,
     113# then the file should exist.
     114if [ -n "$SAGE_FORTRAN_LIB" ] && [ ! -r "$SAGE_FORTRAN_LIB" ]; then
     115    echo >&2 "Error: SAGE_FORTRAN_LIB is defined as '$SAGE_FORTRAN_LIB',"
     116    echo >&2 "but that file does not exist (or isn't readable)."
     117    exit 1
    119118fi
    120119
    121120# Checks that the user is not mixing the Sun and GNU compilers. This problem
    122121# has been seen on code built with the aid of SCons, but in general could
    123122# happen with any code if the user has specified a C compiler but not a C++ one.
    124 # This problem is even more likely to occur with the Fortran compiler - I've done
    125 # it myself when building Sage!
    126 
    127 if [ "x$SUN_COMPILER" = "x1" ] && [ "x$GNU_COMPILER" = "x1" ] ; then
    128    echo "You are mixing the Sun and GNU C/C++/Fortran compilers"
    129    echo "Such a combination will lead to problems."
    130    echo "Check CC, CXX & SAGE_FORTRAN carefully."
    131    echo "Exiting ..."
    132    exit 1
     123# This problem is even more likely to occur with the Fortran compiler - I've
     124# done it myself when building Sage!
     125if [ "x$SUN_COMPILER" = "x1" ] && [ "x$GNU_COMPILER" = "x1" ]; then
     126    echo >&2 "Error: You are mixing the Sun and GNU C/C++/Fortran compilers."
     127    echo >&2 "Such a combination will lead to problems."
     128    echo >&2 "Check the environment variables CC, CXX & SAGE_FORTRAN carefully."
     129    echo >&2 "Exiting ..."
     130    exit 1
    133131fi
    134132
    135 # These are all used by GNU to specify compilers.
     133echo "The following environment variables will be exported:"
     134
     135# These are all used by GNU to specify compilers:
    136136echo "Using CC=$CC"
    137137echo "Using CXX=$CXX"
    138138echo "Using FC=$FC"
    139139echo "Using F77=$F77"
    140140
    141 # Used by Sage in connection with Fortran
     141# Usually, one would add LD here, too.
     142echo "Using MAKE=$MAKE"
     143
     144# Used by Sage in connection with Fortran:
    142145echo "Using SAGE_FORTRAN=$SAGE_FORTRAN"
    143146echo "Using SAGE_FORTRAN_LIB=$SAGE_FORTRAN_LIB"
    144147
    145 # Flags which may be set.
    146 echo "The following environment variables will be exported"
     148# Flags which may be set:
    147149echo "Using CFLAG64=$CFLAG64"
    148150echo "Using CXXFLAG64=$CXXFLAG64"
    149151echo "Using CFLAGS=$CFLAGS"
     
    153155echo "Using CPPFLAGS=$CPPFLAGS"
    154156echo "Using LDFLAGS=$LDFLAGS"
    155157echo "Using ABI=$ABI"
    156 echo "configure scripts and/or makefiles might override these later"
     158echo "'configure' scripts and/or makefiles might override these later."
    157159echo " "
    158160
    159 # export everything. Probably not necessary in most cases.
     161# Export everything. Probably not necessary in most cases.
    160162export CFLAGS
    161163export CXXFLAGS
    162164export FCFLAGS
     
    164166export CPPFLAGS
    165167export LDFLAGS
    166168export ABI
     169# (Variables like CC, CXX etc. have already been exported by 'sage-env'.)
    167170
    168 # End of pretty general spkg-install file.
    169 # Now do the specific things needed for this package (lcalc)
    170 
    171 cd src/src
     171# End of pretty general spkg-install file.
     172# Now do the specific things needed for this package (lcalc).
    172173
    173174success() {
    174175    if [ $? -ne 0 ]; then
    175         echo "Error building lcalc '$1'"
     176        echo >&2 "Error building the Lcalc package: '$1'"
    176177        exit 1
    177178    fi
    178179}
    179180
    180181export DEFINES=""
    181182
    182 # Copy sage specific modifications and build
    183 cp ../../patches/Lcommandline_numbertheory.h ../include/
    184 success "patch: Lcommandline_numbertheory.h"
     183cd src
    185184
    186 cp ../../patches/Lcommandline_elliptic.cc .
    187 success "patch: Lcommandline_elliptic.cc"
     185# Apply Sage-specific patches: (See SPKG.txt for details on the patches.)
     186echo >&2 "Patching the upstream source code for Sage..."
     187for patch in ../patches/*.patch; do
     188    patch -p1 <"$patch"
     189    success "patch $patch failed to apply"
     190done
    188191
    189 cp ../../patches/Makefile Makefile
    190 success "patch: Makefile"
     192# There's currently no 'configure' script for Lcalc; we (also) configure
     193# it by patching the Makefile. This may change in a later release of Lcalc.
    191194
    192 cp ../../patches/Lcommon.h ../include/
    193 success "patch: Lcommon.h"
     195cd src   # Now we are in src/src.
    194196
     197# Build everything:
     198echo >&2 "Now building lcalc, example programs and the shared library..."
    195199$MAKE
    196200success 'make'
    197201
    198 echo "Now copying over lcalc binary"
     202echo >&2 "Now copying over lcalc binary..."
    199203cp lcalc "$SAGE_LOCAL"/bin
    200204success 'copying binary'
    201205
    202 echo "Now copying over lcalc library"
     206echo >&2 "Now copying over lcalc library..."
    203207
    204 #Remove next few lines  when OSX 10.4 is no longer supported
    205 #10.4 does not seem to compile with .so extension in the library files
    206 if [ $UNAME = "Darwin" ]; then
     208# Remove next few lines when MacOS X 10.4 (Darwin 8) is no longer supported.
     209# 10.4 does not seem to compile with .so extension in the library files.
     210if [ "$UNAME" = "Darwin" ]; then
    207211    if [ `sysctl -n kern.osrelease | cut -d . -f 1` -lt 9 ]; then
    208212        cp libLfunction.so "$SAGE_LOCAL"/lib/libLfunction.dylib
    209213        success "copying libLfunction.dylib"
    210214    fi
    211 fi #End of Mac OS X 10.4 specific instructions
     215fi # End of MacOS X 10.4 specific instructions
    212216
    213217
    214 if [ $UNAME = "CYGWIN" ]; then
     218if [ "$UNAME" = "CYGWIN" ]; then
    215219    cp libLfunction.so "$SAGE_LOCAL"/lib/libLfunction.dll
    216220else
    217221    cp libLfunction.so "$SAGE_LOCAL"/lib/
    218222fi
    219223success "copying libLfunction.so"
    220224
    221 echo "Now copying over lcalc library header files"
     225echo >&2 "Now copying over lcalc library header files..."
    222226rm -fr "$SAGE_LOCAL"/include/lcalc
    223227mkdir -p "$SAGE_LOCAL"/include/lcalc
    224228cp ../include/* "$SAGE_LOCAL"/include/lcalc
    225 success 'install'
     229success 'copying header files'