-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
328e282
commit 4e87599
Showing
6 changed files
with
539 additions
and
66 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "cexample.h" | ||
|
||
int fibonacci(int n){ | ||
|
||
int i,a,b,tmp; | ||
a=0; | ||
b=1; | ||
for (i=0;i<(n-1);i++){ | ||
tmp = a+b; | ||
a = b; | ||
b = tmp; | ||
} | ||
return b; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef C_EXAMPLE_H | ||
#define C_EXAMPLE_H | ||
|
||
int fibonacci(int n); | ||
|
||
#endif |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from distutils.core import setup | ||
from distutils.extension import Extension | ||
from Cython.Build import cythonize | ||
|
||
cexample_extension = Extension( | ||
name="wrapcexample", | ||
sources=["wrapcexample.pyx"], | ||
libraries=["cexample"], | ||
library_dirs=["lib"], | ||
include_dirs=["lib"] | ||
) | ||
|
||
setup( | ||
name="wrapcexample", | ||
ext_modules=cythonize([cexample_extension]) | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cdef extern from "cexample.h": | ||
int fibonacci(int n) | ||
|
||
def cfib(n): | ||
cdef m | ||
m = fibonacci(n) | ||
return m |