In trying to translate the following C# code to F#, I'm struggling with the 'using' keyword. The following snippet is from the ILNumerics library. How to translate the following?
ILRetArray<double> ObjFuncBFGS2D(ILInArray<double> X) {
using (ILScope.Enter(X)) {
return X[0] * X[0] + X[1] * X[1] + 2;
}
}
On a side note, what libraries do F# people tend to use for optimization? I've been using NLoptNet but with very strange convergence issues with routines that converge properly in Matlab and Julia and Python. So either the problem is with my F# translations (granted this is more likely) or the optimization libraries. This is what I'm hoping to pin down. Frankly I'm a bit surprised by the lack of numerical optimization material related to F# on the internet.