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
Kirill Smelkov
cython
Commits
5774eaa0
Commit
5774eaa0
authored
Nov 28, 2012
by
Joon Ro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed indentation of a code example
Fixed a code example which had been indented with 2 spaces.
parent
b804af9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
docs/src/tutorial/cdef_classes.rst
docs/src/tutorial/cdef_classes.rst
+9
-9
No files found.
docs/src/tutorial/cdef_classes.rst
View file @
5774eaa0
...
@@ -49,15 +49,15 @@ fast for use from Cython and one slower for use from Python. Then::
...
@@ -49,15 +49,15 @@ fast for use from Cython and one slower for use from Python. Then::
Using this, we can now change our integration example::
Using this, we can now change our integration example::
def integrate(Function f, double a, double b, int N):
def integrate(Function f, double a, double b, int N):
cdef int i
cdef int i
cdef double s, dx
cdef double s, dx
if f is None:
if f is None:
raise ValueError("f cannot be None")
raise ValueError("f cannot be None")
s = 0
s = 0
dx = (b-a)/N
dx = (b-a)/N
for i in range(N):
for i in range(N):
s += f.evaluate(a+i*dx)
s += f.evaluate(a+i*dx)
return s * dx
return s * dx
print(integrate(SinOfSquareFunction(), 0, 1, 10000))
print(integrate(SinOfSquareFunction(), 0, 1, 10000))
...
...
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