public virtual Matrix integratedCovariance(double t, Vector x) { // this implementation is not intended for production. // because it is too slow and too inefficient. // This method is useful for testing and R&D. // Please overload the method within derived classes. //QL_REQUIRE(x.empty(), "can not handle given x here"); try { if (!(x.empty())) { throw new ApplicationException("can not handle given x here"); } } catch { } //x is empty or null Matrix tmp = new Matrix(size_, size_, 0.0); for (int i = 0; i < size_; ++i) { for (int j = 0; j <= i; ++j) { Var_Helper helper = new Var_Helper(this, i, j); GaussKronrodAdaptive integrator = new GaussKronrodAdaptive(1e-10, 10000); for (int k = 0; k < 64; ++k) { tmp[i, j] += integrator.value(helper.value, k * t / 64.0, (k + 1) * t / 64.0); } tmp[j, i] = tmp[i, j]; } } return(tmp); }
public virtual Matrix integratedCovariance(double t, Vector x = null) { // this implementation is not intended for production. // because it is too slow and too inefficient. // This method is useful for testing and R&D. // Please overload the method within derived classes. Utils.QL_REQUIRE(x == null ,()=> "can not handle given x here"); Matrix tmp= new Matrix(size_, size_,0.0); for (int i=0; i<size_; ++i) { for (int j=0; j<=i;++j) { Var_Helper helper = new Var_Helper(this, i, j); GaussKronrodAdaptive integrator=new GaussKronrodAdaptive(1e-10, 10000); for (int k=0; k < 64; ++k) { tmp[i,j] +=integrator.value(helper.value, k * t / 64.0, (k + 1) * t / 64.0); } tmp[j,i]=tmp[i,j]; } } return tmp; }