Topic: issue about stacking oofuns and numpy.arrays

I have mentioned an issue about using numpy arrays with oofuns:

If you are using numpy arrays with oofuns, currently you should avoid operations with right-side oofun and left-side array, e.g. a*f, a/f, a**f, f**a, a-f, a+f etc (a is array and f is oofun or oovar). It will produce numpy array of size same to size(a). Here you should use Python lists instead: a.tolist()*f,a.tolist()/f etc or operations like f*a, f**(-1)*a, -f+a, f+a etc.

This one is due to overloaded Python direct operations (for arrays) __mul__, __add__ etc have greater priority than __rmul__, __radd__ etc, so it cannot be fixed from FuncDesigner only, and operations like myConstr = array([2,3])*myOOVar > someValue will not work correctly.

I hope the issue wil be fixed in future FuncDesigner/numpy releases.

Note - the issue doesn't matter for points passed to oofuns/oovars (i.e. you can use point = {a:array((1,2,3)), b:[1,2], c:3 etc} and apply your oofuns/oovars on those points w/o any problems).

Re: issue about stacking oofuns and numpy.arrays

I have committed bugfix for the issue, to involve the fix you should update FuncDesigner 0.27 to latest svn snapshot.
It appears that numpy has attribute __array_priority__ for this situations, so to prevent invoking numpy __mul__ etc one should add it to his class with value greater than 1; it just wasn't properly mentioned in documentation.