Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
36dfbbca
Commit
36dfbbca
authored
Jun 15, 2018
by
scoder
Committed by
GitHub
Jun 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2330 from gabrieldemarmiesse/test_cdef_classes_2
Added tests for cdef_classes.rst. Part 2.
parents
28bb1ffd
60ae2777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
docs/examples/tutorial/cdef_classes/math_function_2.pyx
docs/examples/tutorial/cdef_classes/math_function_2.pyx
+3
-0
docs/src/tutorial/cdef_classes.rst
docs/src/tutorial/cdef_classes.rst
+2
-4
No files found.
docs/examples/tutorial/cdef_classes/math_function_2.pyx
0 → 100644
View file @
36dfbbca
cdef
class
Function
:
cpdef
double
evaluate
(
self
,
double
x
)
except
*
:
return
0
docs/src/tutorial/cdef_classes.rst
View file @
36dfbbca
...
...
@@ -27,11 +27,9 @@ Cython code and pure Python code.
So far our integration example has not been very useful as it only
integrates a single hard-coded function. In order to remedy this,
with hardly sacrificing speed, we will use a cdef class to represent a
function on floating point numbers:
:
function on floating point numbers:
cdef class Function:
cpdef double evaluate(self, double x) except *:
return 0
.. literalinclude:: ../../examples/tutorial/cdef_classes/math_function_2.pyx
The directive cpdef makes two versions of the method available; one
fast for use from Cython and one slower for use from Python. Then::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment