Created
July 20, 2015 07:43
-
-
Save cyrilpic/264ced9732f602983344 to your computer and use it in GitHub Desktop.
Numba function with LLVM IR parsing error
This file contains hidden or 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
@jit("float64[:], float64[:], float64[:], int64, float64, float64, float64[:]", nopython=True) | |
def cable_cost_function(angles, x1, x2, n, D2, a, memo): | |
t1 = angles[:n] | |
t2 = angles[n:] | |
cost = 0. | |
for i in range(n): | |
s1 = np.sin(t1[i]) | |
c1 = np.cos(t1[i]) | |
s2 = np.sin(t2[i]) | |
c2 = np.cos(t2[i]) | |
x_err = (D2*s1+(x1[i]-D2*t1[i])*c1 - a + D2*s2 + (x2[i]-D2*t2[i])*c2) | |
y_err = (-1.*D2*c1+(x1[i]-D2*t1[i])*s1 + D2*c2 - (x2[i]-D2*t2[i])*s2) | |
cost += x_err*x_err+y_err*y_err | |
dx_err1 = -1.*(x1[i]-1.*D2*t1[i])*s1 | |
dx_err2 = -1.*(x2[i]-1.*D2*t2[i])*s2 | |
dy_err1 = (x1[i]-1.*D2*t1[i])*c1 | |
dy_err2 = -1.*(x2[i]-1.*D2*t2[i])*c2 | |
memo[i] = 2.*x_err*dx_err1+2.*y_err*dy_err1 | |
memo[i+n] = 2.*x_err*dx_err2+2.*y_err*dy_err2 | |
return cost, memo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment