public double HWSwaption(double a, double sigma, double l, double k, double T, Vector s)
{
OptimizationSettings options = new OptimizationSettings();
options.epsilon = 1e-10;
this.dt = s[0] - T;
this.CF = k * this.dt + (new Vector(s.Length));
this.CF[s.Length - 1] = this.CF[s.Length - 1] + 1;
this.a = a;
this.sigma = sigma;
this.t = T;
this.T = s;
this.L = l;
SolutionInfo sol = Fairmat.Optimization.Helper.FSolve(new ObjFunction(this.Func), (Vector)new double[1] { 0.01 },
(Vector)new double[1] { -1.0 }, (Vector)new double[1] { 1.0 }, options);
double RK = (double)sol.x;
Vector X = this.HWBond(a, sigma, RK, this.T, this.t);
double result = 0;
for (int i = 0; i < s.Length; i++)
result += this.CF[i] * this.ZCBPut(a, sigma, 1.0, X[i], T, s[i]);
result = result * l;
return result;
}