Skip to content
Snippets Groups Projects
Commit 654b03d4 authored by David Weir's avatar David Weir
Browse files

README.md: fix typos and broken links

parent bd693c7e
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ code. It also happens that I was familiar with Cython. ...@@ -16,7 +16,7 @@ code. It also happens that I was familiar with Cython.
It took me a couple of hours to figure out how to get this to work It took me a couple of hours to figure out how to get this to work
properly, and with no real tutorial or simple advice to follow, I made properly, and with no real tutorial or simple advice to follow, I made
(a starter kit)[https://version.helsinki.fi/weir/cython-and-scipy] [a starter kit](https://version.helsinki.fi/weir/cython-and-scipy)
showing a minimal working example. showing a minimal working example.
Note that I don't fully know all the jargon names given to bits of Note that I don't fully know all the jargon names given to bits of
...@@ -41,10 +41,10 @@ The starter kit contains the following files: ...@@ -41,10 +41,10 @@ The starter kit contains the following files:
basics](https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html) basics](https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html)
for an explanation of what `cdef` is). We want to turn this into for an explanation of what `cdef` is). We want to turn this into
C, compile it, and then later on use it to instantiate a C, compile it, and then later on use it to instantiate a
`[scipy.LowLevelCallable](https://docs.scipy.org/doc/scipy/reference/generated/scipy.LowLevelCallable.html)` [`scipy.LowLevelCallable`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.LowLevelCallable.html)
instance so `scipy.integrate` can use that rather than working instance so `scipy.integrate` can use that rather than working
with interpreted python (which is slow). with interpreted python (which is slow).
- `test.pxd` is a Cython "header" file (I don't know what the - `test.pxd` is a Cython "header" file (I don't know what the
correct name is, but the [Cython correct name is, but the [Cython
documentation](https://cython.readthedocs.io/en/latest/src/tutorial/pxd_files.html) documentation](https://cython.readthedocs.io/en/latest/src/tutorial/pxd_files.html)
...@@ -58,13 +58,19 @@ The starter kit contains the following files: ...@@ -58,13 +58,19 @@ The starter kit contains the following files:
The corresponding python module then has the attribute The corresponding python module then has the attribute
`__pyx_capi__`, which is also needed for `__pyx_capi__`, which is also needed for
`LowLevelCallable.from_cython()` to work. To be honest, I couldn't `LowLevelCallable.from_cython()` to work. To be honest, I couldn't
find useful documentationa bout this, but I think this means that find useful documentation about this, but I think this means that
it has a 'parallel' C interface, as it were it has a 'parallel' C interface, as it were.
[this](https://github.com/ashwinvis/cython_capi/tree/master/using_pxd)
subdirectory of a repo by Ashwin Vishnu was useful. [This](https://github.com/ashwinvis/cython_capi/tree/master/using_pxd)
subdirectory of a repo by Ashwin Vishnu was useful, as was [this
article](http://pdebuyl.be/blog/2017/cython-module.html) by Pierre
de Buyl.
- `setup.py` is the usual distutils thing, but it knows it's - `setup.py` is the usual distutils thing, but it knows it's
building a Cython module because of the call to `cythonize()`. building a Cython module because of the call to `cythonize()` and
thus detects the `.pxd` file (there is otherwise no relationship
between them, no `cimport` or similar); I'm not entirely
sure, though.
- `run.py` uses the `integrand()` function from `test.pyx` to do - `run.py` uses the `integrand()` function from `test.pyx` to do
some numerical integrals. some numerical integrals.
...@@ -96,7 +102,7 @@ To try this out you will need: python 3, cython ...@@ -96,7 +102,7 @@ To try this out you will need: python 3, cython
Should be 21.333...: 21.3333 Should be 21.333...: 21.3333
Uses Uses
`[scipy.integrate.quad()](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quad.html#scipy.integrate.quad)` [`scipy.integrate.quad()`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.quad.html#scipy.integrate.quad)
to evaluate three numerical integrals. Note that I've tried to to evaluate three numerical integrals. Note that I've tried to
make it clear how to pass numerical coefficients from the python make it clear how to pass numerical coefficients from the python
to the C code, so things don't need to be hardcoded. to the C code, so things don't need to be hardcoded.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment