コード例 #1
0
        public double integratedCovariance(int i, int j, double t, Vector x)
        {
            if (corrModel_.isTimeIndependent())
            {
                try {
                    // if all objects support these methods
                    // thats by far the fastest way to get the
                    // integrated covariance
                    return(corrModel_.correlation(i, j, 0.0, x)
                           * volaModel_.integratedVariance(j, i, t, x));
                    //verifier la methode integratedVariance, qui bdoit etre implémenté
                }
                catch (System.Exception Error) {
                    // okay proceed with the
                    // slow numerical integration routine
                }
            }

            //QL_REQUIRE(x.empty(), "can not handle given x here");
            try {
                if (x.empty() == false)
                {
                    throw new ApplicationException("can not handle given x here");
                }
            }
            catch { //OK x empty
            }

            double          tmp    = 0.0;
            VarProxy_Helper helper = new VarProxy_Helper(this, i, j);

            GaussKronrodAdaptive integrator = new GaussKronrodAdaptive(1e-10, 10000);

            for (int k = 0; k < 64; ++k)
            {
                tmp += integrator.value(helper.value, k * t / 64.0, (k + 1) * t / 64.0);
            }
            return(tmp);
        }