This file contains hidden or 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
| >>> def loop(): | |
| ... total = 0 | |
| ... while 1: | |
| ... total += 1 | |
| ... | |
| >>> import dis | |
| >>> dis.dis(loop) | |
| 3 0 LOAD_CONST 1 (0) | |
| 3 STORE_FAST 0 (total) |
This file contains hidden or 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
| .tox/ | |
| /MANIFEST |
This file contains hidden or 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
| # see http://conference.scipy.org/proceedings/SciPy2009/paper_2/ | |
| import threading | |
| cimport cython | |
| import numpy as np | |
| cimport numpy as np | |
| ctypedef np.float64_t dtype_t | |
| def matmul(A, B, out=None): |
This file contains hidden or 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
| *.o |
This file contains hidden or 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
| In [1]: import numpy as np | |
| In [2]: a = np.r_[.1:4:40j] | |
| In [3]: a | |
| Out[3]: | |
| array([ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, | |
| 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2. , 2.1, 2.2, | |
| 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3. , 3.1, 3.2, 3.3, | |
| 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4. ]) |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """ | |
| Cython-compatible wrapper for doctest.testmod(). | |
| Usage example, assuming a Cython module mymod.pyx is compiled. | |
| This is run from the command line, passing a command to Python: | |
| python -c "import cydoctest, mymod; cydoctest.testmod(mymod)" | |
| (This still won't let a Cython module run its own doctests | |
| when called with "python mymod.py", but it's pretty close. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import pycuda.gpuarray as gpuarray | |
| import pycuda.autoinit | |
| from pycuda.elementwise import ElementwiseKernel | |
| # define elementwise `add()` function | |
| add = ElementwiseKernel( | |
| "float *a, float *b, float *c", | |
| "c[i] = a[i] + b[i]", |
This file contains hidden or 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
| /build/ | |
| *.so | |
| *.cpp | |
| /cachegrind.out.profilestats | |
| /profilestats.prof | |
| /build1darray.s |
This file contains hidden or 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/sh | |
| # | |
| # Get all posts from del.icio.us | |
| # See http://www.delicious.com/help/api | |
| # | |
| USER=$1 | |
| OUT=posts-${USER}.xml | |
| [ -z "$USER" ] && echo "USAGE: $0 USERNAME" && exit 2 |
This file contains hidden or 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
| # | |
| /cachegrind.out.profilestats | |
| /profilestats.prof |