Skip to content

Instantly share code, notes, and snippets.

@PhDP
Created December 13, 2011 22:02
Show Gist options
  • Save PhDP/1474101 to your computer and use it in GitHub Desktop.
Save PhDP/1474101 to your computer and use it in GitHub Desktop.
Weave example
# Example with weave
#
# Required packages (linux): python-scipy, python-dev
#
# phdp@thinkpad:~$ python testweave.py
# 9784957257.9
import numpy as np
from scipy.weave import inline
a, b, c = 5.5, 8.5, 10.5
code = """ return_val = log(a) * pow(b, c) - sqrt(a + b); """
res = inline(code, ['a', 'b', 'c'], headers = ['<math.h>'], compiler = 'gcc')
print(res)
@tpoisot
Copy link

tpoisot commented Dec 13, 2011

;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment