Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cython and Scipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Weir
Cython and Scipy
Commits
654b03d4
Commit
654b03d4
authored
4 years ago
by
David Weir
Browse files
Options
Downloads
Patches
Plain Diff
README.md: fix typos and broken links
parent
bd693c7e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+15
-9
15 additions, 9 deletions
README.md
with
15 additions
and
9 deletions
README.md
+
15
−
9
View file @
654b03d4
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment