/// <summary>
        /// Initialise the SABR parameter beta to the value that will be used
        /// during calibration of the SABR model.
        /// Function checks for a valid beta parameter.
        /// Post condition: private field _beta is set, provided that the input
        /// value beta is valid.
        /// </summary>
        /// <param name="beta">Override for the SABR parameter beta.</param>
        private void InitialiseBeta(decimal beta)
        {
            // SABR parameter beta provided: check validity.
            var errorMessage = "";
            var isValid      =
                SABRParameters.CheckSABRParameterBeta(beta, ref errorMessage);

            if (!isValid)
            {
                throw new System.ArgumentException(errorMessage);
            }
            Beta = beta;
        }
 /// <summary>
 /// Constructor for the class <see cref="SABRImpliedVolatility"/>.
 /// </summary>
 /// <param name="sabrParameters">Object that contains all the
 /// SABR parameters.</param>
 /// <param name="checkSABRParameters">Flag used to signal whether
 /// the parameters for the SABR model require validation (true)
 /// or no validation required (false).</param>
 public SABRImpliedVolatility(SABRParameters sabrParameters,
                              bool checkSABRParameters)
 {
     // Inspect whether a check of the SABR parameters has been requested.
     if (checkSABRParameters)
     {
         // Check of the SABR parameters requested.
         var errorMessage           = "";
         var allSABRParametersValid =
             SABRParameters.CheckSABRParameters(sabrParameters,
                                                ref errorMessage);
         if (!allSABRParametersValid)
         {
             // Invalid SABR parameter found.
             throw new ArgumentException(errorMessage);
         }
     }
     // SABR parameters are either all valid or a check of the these
     // parameters has not been requested: store all SABR parameters.
     _alpha = sabrParameters.Alpha;
     _beta  = sabrParameters.Beta;
     _nu    = sabrParameters.Nu;
     _rho   = sabrParameters.Rho;
 }