CodePlexProject Hosting for Open Source Software

1

Closed

It would be great if there was a compile function with the following signature:

Compile(Variable[] variablesForWhichToComputeDerivatives, Variables[] parameters)

one would then call this compiled thing like this, assuming that a,b,c,d,e are all variables:

var compiledTerm= term.Compile(new Variable[] {a,b}, new Variable[] {c,d,e});

var res = compiledTerm.Evaluate(new double[] {3,2}, new double[] {4,5,6});

this would give me back the partial derivatives of the term with respect to a and b, evaluated at a=3, b=2, c=4 etc.

Essentially this would allow me to have constant terms in my function, but I can change the value of these constant terms between calls to evaluate.

Compile(Variable[] variablesForWhichToComputeDerivatives, Variables[] parameters)

one would then call this compiled thing like this, assuming that a,b,c,d,e are all variables:

var compiledTerm= term.Compile(new Variable[] {a,b}, new Variable[] {c,d,e});

var res = compiledTerm.Evaluate(new double[] {3,2}, new double[] {4,5,6});

this would give me back the partial derivatives of the term with respect to a and b, evaluated at a=3, b=2, c=4 etc.

Essentially this would allow me to have constant terms in my function, but I can change the value of these constant terms between calls to evaluate.

No files are attached

## comments

alexshtf wrote Oct 29, 2011 at 3:08 PM

The performance hit is not that visible, unless you have a really small number of "real" variables compared to the number of constants.

This is how I will implement the proposed API - right now I prefer correctness. If there is an actual performance problem I will write a specialized implementation that will compute the gradient only for the required variables.

wrote Oct 30, 2011 at 11:08 PM