b45ch1/pyadolc — Issue #12: adub and adouble conversion?
Author: xuchen
Created: 2012-02-27 15:27:24+00:00
State: open

I'm a bit puzzled by the implicit conversion between adub and adouble in pyadolc. I encountered the following error in my code:

Traceback (most recent call last):
File "", line 1, in
File "", line 5, in f
ArgumentError: Python argument types in
adolc._adolc.condassign(adub, adub, adub)
did not match C++ signature:
condassign(adouble {lvalue}, adouble, adouble, adouble)
condassign(adouble {lvalue}, adouble, adouble)
condassign(double, double, double, double)
condassign(double, double, double)

To help reproduce it, I construct the following minimal example:

```python
def f(x):
b = x*5
y = x*2
c = y + x
# if b > 0, then y = c
y = condassign(y,b,c)
return y
trace_on(0)
ax = adouble(2.0)
independent(ax)
ay = f(ax)
```

upon executing ay = f(ax), I had the error.

In C++, y,b,c in f(x) would've been defined as adouble, so they won't be converted to adub during execution (my guess). However, the python code seems to automatically assigns them as adub. Any insight?