예제 #1
0
        public override Matrix covariance(double t, Vector x)
        {
            Vector volatility  = volaModel_.volatility(t, x);
            Matrix correlation = corrModel_.correlation(t, x);

            Matrix tmp = new Matrix(size_, size_);

            for (int i = 0; i < size_; ++i)
            {
                for (int j = 0; j < size_; ++j)
                {
                    tmp[i, j] = volatility[i] * correlation[i, j] * volatility[j];
                }
            }
            return(tmp);
        }
예제 #2
0
        public double value(double t)
        {
            double v1, v2;

            if (i_ == j_)
            {
                v1 = v2 = volaModel_.volatility(i_, t, null);
            }
            else
            {
                v1 = volaModel_.volatility(i_, t, null);
                v2 = volaModel_.volatility(j_, t, null);
            }
            return(v1 * corrModel_.correlation(i_, j_, t, null) * v2);
        }