Hello all,

I would like to run the same code both:

- with as inputs MX variables, so that it's differentiable;

- with as inputs just constants.

I'll give a small toy example:

from casadi import * t = MX("t",1) def f(tin): out = MX.zeros(2) out[0] = tin+2 out[1] = tin-2 return out print f(t) #MX variable as input >> mapping(dense 2-by-1 matrix, dependencies: [[0,0],(t+2),(t-2)], nonzeros: [0(1),0(2),]) print f(5) #constant (i.e., non-casadi variable) as input >> mapping(dense 2-by-1 matrix, dependencies: [[0,0],7,3], nonzeros: [0(1),0(2),]) outfun = MXFunction([],[f(5)]) outfun.init() outfun.evaluate() print outfun.output() >> [7,3]

The second mapping doesn't contain any variables anymore, so is it possible to just convert this MX to a constant array, without all the hassle of creating a function without inputs, initiating it, evaluating it and outputting it?