Hello all,
I have a bit of a problem with the minimize_constrained function: When I call
minimize_constrained(lambda x: x^2, [lambda x: 1], 99.6)
I get a TypeError: iteration over a 0-d array
(why?). If I call
minimize_constrained(lambda x: x^2, \
[lambda x: vector({0:1,1:x}).inner_product(vector((0,0)))], 99.6)
I get a TypeError: unable to find a common ring for all elements
.
This seems to be the case because the the constraint function is sometimes called
with a numpy.ndarray
and at other times with a sage.modules.vector_real_double_dense.Vector_real_double_dense
. In the first case
I need to call float(x[0])
, in the latter I can use x[0]
directly.
Is it be possible to convert the data to sage vectors throughout the iterations or do I have to set up a handler to sanitize the input myself?