HullAndWhiteOneFactor.SwaptionHW1.HWSwaption C# (CSharp) Method

HWSwaption() public method

Price of a swaption in HW1 model: the holder has the right to pay the fixed rate and receive floating rate. This is a different version of the main one to do a double check of the swaption.
public HWSwaption ( double a, double sigma, double l, double k, double T, Vector s ) : double
a double /// Hull-White alpha parameter. ///
sigma double /// Hull-White sigma parameter. ///
l double /// The Notional. ///
k double /// The Strike. ///
T double /// The maturity. ///
s Vector /// Vector of swaption payment dates. ///
return double
        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;
        }

Same methods

SwaptionHW1::HWSwaption ( double a, double sigma, double l, double k, double swaptionMaturity, double swapDuration, double deltaK ) : double