Skip to content

Instantly share code, notes, and snippets.

@pv
pv / epsilon.py
Last active November 10, 2020 13:12
Wynn epsilon table algorithm
# -*- coding:utf-8 -*-
from __future__ import division, absolute_import, print_function
import sys
import math
import collections
try:
from math import inf, nan
except ImportError:
@pv
pv / timeit_asv_setup.py
Last active November 1, 2018 18:24
Timeit asv benchmark setup() routines, look for slow ones.
"""
Timeit asv benchmark setup() routines, look for slow ones.
Looks for benchmarks under './benchmarks/' directory.
"""
import os
import time
import itertools
import tempfile
import shutil
$ make diff
...
$ make diff
make -s run "PYTHON=/home/pauli/prj/scipy/cutestrunpy/env/bin/python" "SCRIPT=cutest_slsqp.py" PYCUTEST_CACHE="/home/pauli/prj/scipy/cutestrunpy/cache/installed" 2>&1|tee run-installed.log
1.1.0
==============================================================
| name | nit | nfev |success |cons_ok |ok_trust_constr|
--------------------------------------------------------------
| HS7 | 11 | 14 | 1 | 1 | 1 |
| HS10 | 11 | 12 | 1 | 1 | 1 |
@pv
pv / vg.log
Last active April 2, 2018 18:19
pypy3-2781-vg.log
$ pypy3
Python 3.5.3 (47bcad155e44, Mar 30 2018, 19:05:26)
[PyPy 5.11.0-alpha0 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux
$ OPT="-O0 -ggdb" pypy3 -mpip install numpy==1.14.2
$ cat runthis.py
import numpy as np
print(np.__file__, np.__version__)
x = np.zeros([1], dtype=int)
@pv
pv / Makefile
Last active August 12, 2017 15:08
LAPACK test suite makefile
#
# Makefile for running LAPACK testsuite
#
FC = gfortran
FFLAGS = -O2
LDFLAGS =
LIBS = -llapack -lblas
LD = $(FC)
AR = ar
! testdpotr_test_gh_2691.f90
!
! Direct Fortran translation of the Scipy test
! TestDpotr.test_gh_2691
!
subroutine garbage(okflag)
implicit none
integer, intent(out) :: okflag
double precision, dimension(3,3) :: a, a2
integer, parameter :: lwork = 100
numpy/benchmarks$ asv --version
asv 0.3.dev1069+3f14e671
numpy/benchmarks$ time asv run -E existing --bench bench_core
· Discovering benchmarks
· Running 29 total benchmarks (1 commits * 1 environments * 29 benchmarks)
[ 0.00%] ·· Building for existing-py_usr_bin_python
[ 0.00%] ·· Benchmarking existing-py_usr_bin_python
[ 3.45%] ··· Running bench_core.Core.time_arange_100 525.16ns
[ 6.90%] ··· Running bench_core.Core.time_array_1 343.88ns
[ 10.34%] ··· Running bench_core.Core.time_array_empty 545.93ns
@pv
pv / qhull_test.c
Last active August 11, 2016 17:48
#include <stdlib.h>
#include <libqhull_r/libqhull_r.h>
static double points[] = {
0.16577534087020684, -1.4005379279472099,
1.3471447295999897, 0.1881148811227809,
1.2882417449678667, -2.2184892610712645,
105.76092199244057, -78.34866809894842,
-1.4890379590829337, -0.19466063858976068,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from math import sin, pi
from scipy.integrate import quad
def remainder_map(a, b, xs, xe):
period = xe - xs
interval = b - a
n_periods, left = divmod(interval, period)