Skip to content

Commit

Permalink
Merge pull request #32 from pkgw/fix-big-data
Browse files Browse the repository at this point in the history
Fix datasets bigger than 16 GB
  • Loading branch information
pkgw committed Feb 24, 2018
2 parents 510753d + 20ed697 commit f5bda9a
Show file tree
Hide file tree
Showing 62 changed files with 401 additions and 336 deletions.
10 changes: 5 additions & 5 deletions aipy_src/_cephes/_cephesmodule.c
Expand Up @@ -9,7 +9,7 @@
* Revisions 2008 Aaron Parsons: stripped out fortran routines
*/

#include "Python.h"
#include <Python.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "ufunc_extras.h"
Expand Down Expand Up @@ -150,16 +150,16 @@ static void * kolmogi_data[] = { (void *)kolmogi, (void *)kolmogi, };
static void * besselpoly_data[] = {(void *)besselpoly, (void *)besselpoly,};


static char cephes_6_types[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE,};
static char cephes_6_types[] = { NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE,};




static char cephes_4_types[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE,};
static char cephes_4_types[] = { NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE,};


static char cephes_3_types[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, };
static char cephes_2_types[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, };
static char cephes_3_types[] = { NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, };
static char cephes_2_types[] = { NPY_FLOAT, NPY_FLOAT, NPY_DOUBLE, NPY_DOUBLE, };


/* Some functions needed from ufunc object, so that Py_complex's aren't being returned
Expand Down
8 changes: 4 additions & 4 deletions aipy_src/_cephes/cephes/bdtr.c
Expand Up @@ -151,7 +151,7 @@ Copyright 1984, 1987, 1995 by Stephen L. Moshier
double incbet(), incbi(), pow(), log1p(), expm1();
#endif

extern double NAN;
extern double CEPHES_NAN;

double bdtrc( k, n, p )
int k, n;
Expand All @@ -168,7 +168,7 @@ if( n < k )
{
domerr:
mtherr( "bdtrc", DOMAIN );
return( NAN);
return(CEPHES_NAN);
}

if( k == n )
Expand Down Expand Up @@ -203,7 +203,7 @@ if( (k < 0) || (n < k) )
{
domerr:
mtherr( "bdtr", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}

if( k == n )
Expand Down Expand Up @@ -235,7 +235,7 @@ if( (k < 0) || (n <= k) )
{
domerr:
mtherr( "bdtri", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}

dn = n - k;
Expand Down
5 changes: 5 additions & 0 deletions aipy_src/_cephes/cephes/cephes_names.h
@@ -1,6 +1,11 @@
#ifndef CEPHES_NAMES_H
#define CEPHES_NAMES_H

#undef signbit
#define signbit cephes_signbit
#undef isfinite
#define isfinite cephes_isfinite

#define airy cephes_airy
#define bdtrc cephes_bdtrc
#define bdtr cephes_bdtr
Expand Down
8 changes: 4 additions & 4 deletions aipy_src/_cephes/cephes/chdtr.c
Expand Up @@ -153,7 +153,7 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
double igamc(), igam(), igami();
#endif

extern double NAN;
extern double CEPHES_NAN;

double chdtrc(df,x)
double df, x;
Expand All @@ -163,7 +163,7 @@ if (x < 0.0) return 1.0; /* modified by T. Oliphant */
if (df < 1.0)
{
mtherr( "chdtrc", DOMAIN );
return(NAN);
return(CEPHES_NAN);
}
return( igamc( df/2.0, x/2.0 ) );
}
Expand All @@ -177,7 +177,7 @@ double df, x;
if( (x < 0.0) || (df < 1.0) )
{
mtherr( "chdtr", DOMAIN );
return(NAN);
return(CEPHES_NAN);
}
return( igam( df/2.0, x/2.0 ) );
}
Expand All @@ -192,7 +192,7 @@ double x;
if( (y < 0.0) || (y > 1.0) || (df < 1.0) )
{
mtherr( "chdtri", DOMAIN );
return(NAN);
return(CEPHES_NAN);
}

x = igami( 0.5 * df, y );
Expand Down
32 changes: 16 additions & 16 deletions aipy_src/_cephes/cephes/const.c
Expand Up @@ -89,14 +89,14 @@ double LOGSQ2 = 3.46573590279972654709E-1; /* log(2)/2 */
double THPIO4 = 2.35619449019234492885; /* 3*pi/4 */
double TWOOPI = 6.36619772367581343075535E-1; /* 2/pi */
#ifdef INFINITIES
double INFINITY = 1.0/0.0; /* 99e999; */
double CEPHES_INFINITY = 1.0/0.0; /* 99e999; */
#else
double INFINITY = 1.79769313486231570815E308; /* 2**1024*(1-MACHEP) */
double CEPHES_INFINITY = 1.79769313486231570815E308; /* 2**1024*(1-MACHEP) */
#endif
#ifdef NANS
double NAN = 1.0/0.0 - 1.0/0.0;
double CEPHES_NAN = 1.0/0.0 - 1.0/0.0;
#else
double NAN = 0.0;
double CEPHES_NAN = 0.0;
#endif
#ifdef MINUSZERO
double NEGZERO = -0.0;
Expand Down Expand Up @@ -135,14 +135,14 @@ unsigned short LOGSQ2[4] = {0x39ef,0xfefa,0x2e42,0x3fd6};
unsigned short THPIO4[4] = {0x21d2,0x7f33,0xd97c,0x4002};
unsigned short TWOOPI[4] = {0xc883,0x6dc9,0x5f30,0x3fe4};
#ifdef INFINITIES
unsigned short INFINITY[4] = {0x0000,0x0000,0x0000,0x7ff0};
unsigned short CEPHES_INFINITY[4] = {0x0000,0x0000,0x0000,0x7ff0};
#else
unsigned short INFINITY[4] = {0xffff,0xffff,0xffff,0x7fef};
unsigned short CEPHES_INFINITY[4] = {0xffff,0xffff,0xffff,0x7fef};
#endif
#ifdef NANS
unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x7ffc};
unsigned short CEPHES_NAN[4] = {0x0000,0x0000,0x0000,0x7ffc};
#else
unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x0000};
unsigned short CEPHES_NAN[4] = {0x0000,0x0000,0x0000,0x0000};
#endif
#ifdef MINUSZERO
unsigned short NEGZERO[4] = {0x0000,0x0000,0x0000,0x8000};
Expand Down Expand Up @@ -181,14 +181,14 @@ unsigned short LOGSQ2[4] = {0x3fd6,0x2e42,0xfefa,0x39ef};
unsigned short THPIO4[4] = {0x4002,0xd97c,0x7f33,0x21d2};
unsigned short TWOOPI[4] = {0x3fe4,0x5f30,0x6dc9,0xc883};
#ifdef INFINITIES
unsigned short INFINITY[4] = {0x7ff0,0x0000,0x0000,0x0000};
unsigned short CEPHES_INFINITY[4] = {0x7ff0,0x0000,0x0000,0x0000};
#else
unsigned short INFINITY[4] = {0x7fef,0xffff,0xffff,0xffff};
unsigned short CEPHES_INFINITY[4] = {0x7fef,0xffff,0xffff,0xffff};
#endif
#ifdef NANS
unsigned short NAN[4] = {0x7ff8,0x0000,0x0000,0x0000};
unsigned short CEPHES_NAN[4] = {0x7ff8,0x0000,0x0000,0x0000};
#else
unsigned short NAN[4] = {0x0000,0x0000,0x0000,0x0000};
unsigned short CEPHES_NAN[4] = {0x0000,0x0000,0x0000,0x0000};
#endif
#ifdef MINUSZERO
unsigned short NEGZERO[4] = {0x8000,0x0000,0x0000,0x0000};
Expand Down Expand Up @@ -219,8 +219,8 @@ unsigned short LOGSQ2[4] = {037661,071027,0173721,0147572,};
unsigned short THPIO4[4] = {040426,0145743,0174631,007222,};
unsigned short TWOOPI[4] = {040042,0174603,067116,042025,};
/* Approximate infinity by MAXNUM. */
unsigned short INFINITY[4] = {077777,0177777,0177777,0177777,};
unsigned short NAN[4] = {0000000,0000000,0000000,0000000};
unsigned short CEPHES_INFINITY[4] = {077777,0177777,0177777,0177777,};
unsigned short CEPHES_NAN[4] = {0000000,0000000,0000000,0000000};
#ifdef MINUSZERO
unsigned short NEGZERO[4] = {0000000,0000000,0000000,0100000};
#else
Expand All @@ -246,7 +246,7 @@ extern unsigned short LOGE2[];
extern unsigned short LOGSQ2[];
extern unsigned short THPIO4[];
extern unsigned short TWOOPI[];
extern unsigned short INFINITY[];
extern unsigned short NAN[];
extern unsigned short CEPHES_INFINITY[];
extern unsigned short CEPHES_NAN[];
extern unsigned short NEGZERO[];
#endif
4 changes: 2 additions & 2 deletions aipy_src/_cephes/cephes/ellpe.c
Expand Up @@ -182,7 +182,7 @@ static unsigned short Q[] = {
double polevl(), log();
#endif

extern double NAN;
extern double CEPHES_NAN;

double ellpe(x)
double x;
Expand All @@ -193,7 +193,7 @@ if( (x <= 0.0) || (x > 1.0) )
if( x == 0.0 )
return( 1.0 );
mtherr( "ellpe", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}
return( polevl(x,P,10) - log(x) * (x * polevl(x,Q,9)) );
}
10 changes: 5 additions & 5 deletions aipy_src/_cephes/cephes/ellpj.c
Expand Up @@ -67,7 +67,7 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
double sqrt(), fabs(), sin(), cos(), asin(), tanh();
double sinh(), cosh(), atan(), exp();
#endif
extern double PIO2, MACHEP, NAN;
extern double PIO2, MACHEP, CEPHES_NAN;

int ellpj( u, m, sn, cn, dn, ph )
double u, m;
Expand All @@ -83,10 +83,10 @@ int i;
if( m < 0.0 || m > 1.0 )
{
mtherr( "ellpj", DOMAIN );
*sn = NAN;
*cn = NAN;
*ph = NAN;
*dn = NAN;
*sn = CEPHES_NAN;
*cn = CEPHES_NAN;
*ph = CEPHES_NAN;
*dn = CEPHES_NAN;
return(-1);
}
if( m < 1.0e-9 )
Expand Down
4 changes: 2 additions & 2 deletions aipy_src/_cephes/cephes/ellpk.c
Expand Up @@ -204,7 +204,7 @@ static double C1 = 1.3862943611198906188E0; /* log(4) */
#ifndef ANSIPROT
double polevl(), p1evl(), log();
#endif
extern double MACHEP, MAXNUM, NAN;
extern double MACHEP, MAXNUM, CEPHES_NAN;

double ellpk(x) /* Changed to use m argument rather than m1 = 1-m */
double x;
Expand All @@ -214,7 +214,7 @@ x = 1.0-x;
if( (x < 0.0) || (x > 1.0) )
{
mtherr( "ellpk", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}

if( x > MACHEP )
Expand Down
8 changes: 4 additions & 4 deletions aipy_src/_cephes/cephes/euclid.c
Expand Up @@ -44,10 +44,10 @@ typedef struct

/* Add fractions. */
#ifdef ANSIPROT
static void radd(fract*,fract*,fract*);
static void rsub(fract*,fract*,fract*);
static void rmul(fract*,fract*,fract*);
static void rdiv(fract*,fract*,fract*);
void radd(fract*,fract*,fract*);
void rsub(fract*,fract*,fract*);
void rmul(fract*,fract*,fract*);
void rdiv(fract*,fract*,fract*);
#endif

void radd( f1, f2, f3 )
Expand Down
4 changes: 2 additions & 2 deletions aipy_src/_cephes/cephes/exp10.c
Expand Up @@ -161,7 +161,7 @@ int isnan(), isfinite();
#endif
extern double MAXNUM;
#ifdef INFINITIES
extern double INFINITY;
extern double CEPHES_INFINITY;
#endif

double exp10(double x)
Expand All @@ -176,7 +176,7 @@ if( isnan(x) )
if( x > MAXL10 )
{
#ifdef INFINITIES
return( INFINITY );
return(CEPHES_INFINITY );
#else
mtherr( "exp10", OVERFLOW );
return( MAXNUM );
Expand Down
4 changes: 2 additions & 2 deletions aipy_src/_cephes/cephes/exp2.c
Expand Up @@ -123,7 +123,7 @@ double polevl(), p1evl(), floor(), ldexp();
int isnan(), isfinite();
#endif
#ifdef INFINITIES
extern double INFINITY;
extern double CEPHES_INFINITY;
#endif
extern double MAXNUM;

Expand All @@ -139,7 +139,7 @@ if( isnan(x) )
if( x > MAXL2)
{
#ifdef INFINITIES
return( INFINITY );
return(CEPHES_INFINITY );
#else
mtherr( "exp2", OVERFLOW );
return( MAXNUM );
Expand Down
8 changes: 4 additions & 4 deletions aipy_src/_cephes/cephes/fdtr.c
Expand Up @@ -165,7 +165,7 @@ Copyright 1984, 1987, 1995 by Stephen L. Moshier
double incbet(), incbi();
#endif

extern double NAN;
extern double CEPHES_NAN;

double fdtrc( a, b, x )
double a, b;
Expand All @@ -176,7 +176,7 @@ double w;
if( (a < 1.0) || (b < 1.0) || (x < 0.0) )
{
mtherr( "fdtrc", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}
w = b / (b + a * x);
return( incbet( 0.5*b, 0.5*a, w ) );
Expand All @@ -191,7 +191,7 @@ double w;
if( (a < 1.0) || (b < 1.0) || (x < 0.0) )
{
mtherr( "fdtr", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}
w = a * x;
w = w / (b + w);
Expand All @@ -208,7 +208,7 @@ double w, x;
if( (a < 1.0) || (b < 1.0) || (y <= 0.0) || (y > 1.0) )
{
mtherr( "fdtri", DOMAIN );
return( NAN );
return(CEPHES_NAN );
}
y = 1.0-y;
a = a;
Expand Down

0 comments on commit f5bda9a

Please sign in to comment.