This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from mpmath import mp | |
from scipy import special | |
def an_func(a, b, k): | |
if a + b == 0: | |
if k == 0: | |
return (b-a)/(2+a+b) | |
else: | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define NPY_NO_DEPRECATED_API NPY_API_VERSION | |
#include <Python.h> | |
#include <numpy/arrayobject.h> | |
#include "numpy/npy_3kcompat.h" | |
PyObject* sum_and_prod(PyArrayObject *arr, int *axis, int naxis) | |
{ | |
NpyIter *iter_outer, *iter_inner; | |
NpyIter_IterNextFunc *iternext_outer, *iternext_inner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import numpy as np | |
from numpy.testing import measure | |
def bench_inf_norm_1d(dtype='d', strided=False, with_nan=False): | |
vec_size = [10, 100, 1000, 10000, 100000, 1000000 ] | |
repeat = [100000, 100000, 100000, 40000, 7500, 1000] | |
call_both = lambda x: abs(x).max() | |
call_norm = lambda x: np.linalg.norm(x, np.inf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the contents of the attachment from http://mail.scipy.org/pipermail/scipy-user/2009-March/020331.html | |
See also https://github.com/scipy/scipy/issues/4288 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.special as cephes | |
import scipy.linalg as linalg | |
from mpmath import mp | |
# current scipy routine | |
def _gen_roots_and_weights(n, mu0, an_func, bn_func, f, df, symmetrize, mu): | |
"""[x,w] = gen_roots_and_weights(n,an_func,sqrt_bn_func,mu) | |
Returns the roots (x) of an nth order orthogonal polynomial, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 2 ] | |
then | |
funcs=($2) | |
else | |
funcs=(CCOS CSIN CTAN CCOSH CSINH CTANH CACOS CASIN CATAN CACOSH CASINH CATANH CEXP CLOG CSQRT CPOW) | |
fi | |
for f in ${funcs[*]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fenv.h> | |
#include <float.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <complex.h> | |
#ifdef FLOAT | |
#define TYPE float | |
#define SUFFIX f | |
#define EPS FLT_EPSILON |