Пример #1
0
        public LiborForwardModel(LiborForwardModelProcess process,
                                 LmVolatilityModel volaModel,
                                 LmCorrelationModel corrModel)
            : base(volaModel.parameters().Count + corrModel.parameters().Count)
        {
            f_             = new InitializedList <double>(process.size());
            accrualPeriod_ = new InitializedList <double>(process.size());
            covarProxy_    = new LfmCovarianceProxy(volaModel, corrModel);
            process_       = process;

            int k = volaModel.parameters().Count;

            for (int j = 0; j < k; j++)
            {
                arguments_[j] = volaModel.parameters()[j];
            }
            for (int j = 0; j < corrModel.parameters().Count; j++)
            {
                arguments_[j + k] = corrModel.parameters()[j];
            }

            for (int i = 0; i < process.size(); ++i)
            {
                accrualPeriod_[i] = process.accrualEndTimes()[i]
                                    - process.accrualStartTimes()[i];
                f_[i] = 1.0 / (1.0 + accrualPeriod_[i] * process_.initialValues()[i]);
            }
        }
Пример #2
0
 public VarProxy_Helper(LfmCovarianceProxy proxy, int i, int j)
 {
     i_         = i;
     j_         = j;
     volaModel_ = proxy.volaModel_;
     corrModel_ = proxy.corrModel_;
 }
Пример #3
0
        public LiborForwardModel(LiborForwardModelProcess process,
                          LmVolatilityModel volaModel,
                          LmCorrelationModel corrModel)
            : base(volaModel.parameters().Count() + corrModel.parameters().Count())
        {
            f_ = new InitializedList<double>(process.size());
            accrualPeriod_ = new InitializedList<double>(process.size());
            covarProxy_=new LfmCovarianceProxy(volaModel, corrModel);
            process_=process;

            /*copy(volaModel.parameters().begin(), volaModel.parameters().end(),
            arguments_.begin());
            copy(corrModel.parameters().begin(), corrModel.parameters().end(),
            arguments_.begin()+k);*/

            int k=volaModel.parameters().Count;
            for (int j = 0; j < k; j++)
                arguments_[j] = volaModel.parameters()[j];
            for (int j = 0; j < corrModel.parameters().Count; j++)
                arguments_[j+k] = corrModel.parameters()[j];

            for (int i=0; i < process.size(); ++i) {
                accrualPeriod_[i] =  process.accrualEndTimes()[i]
                                - process.accrualStartTimes()[i];
                f_[i] = 1.0/(1.0+accrualPeriod_[i]*process_.initialValues()[i]);
            }
        }
Пример #4
0
        public LfmCovarianceProxy(LmVolatilityModel volaModel,
                                  LmCorrelationModel corrModel)
            : base(corrModel.size(), corrModel.factors())
        {
            volaModel_ = volaModel;
            corrModel_ = corrModel;

            Utils.QL_REQUIRE(volaModel_.size() == corrModel_.size(), () =>
                             "different size for the volatility (" + volaModel_.size() + ") and correlation (" + corrModel_.size() + ") models");
        }
        public LfmCovarianceProxy(LmVolatilityModel volaModel,
                           LmCorrelationModel corrModel)
            : base(corrModel.size(), corrModel.factors()){
            volaModel_=volaModel;
            corrModel_=corrModel ;

            if(!(volaModel_.size() == corrModel_.size()))
                throw new ArgumentException("different size for the volatility (" + volaModel_.size() +
                                            ") and correlation (" + corrModel_.size() +
                                            ") models");
        }
Пример #6
0
        public LfmCovarianceProxy(LmVolatilityModel volaModel,
                                  LmCorrelationModel corrModel)
            : base(corrModel.size(), corrModel.factors())
        {
            volaModel_ = volaModel;
            corrModel_ = corrModel;

            if (!(volaModel_.size() == corrModel_.size()))
            {
                throw new ArgumentException("different size for the volatility (" + volaModel_.size() +
                                            ") and correlation (" + corrModel_.size() +
                                            ") models");
            }
        }
Пример #7
0
 public LmConstWrapperCorrelationModel(LmCorrelationModel corrModel)
     : base(corrModel.size(), 0)
 {
     corrModel_=corrModel;
 }
Пример #8
0
 public VarProxy_Helper(LfmCovarianceProxy proxy, int i, int j)
 {
     i_=i;
     j_=j;
     volaModel_=proxy.volaModel_;
     corrModel_=proxy.corrModel_;
 }
 public LmConstWrapperCorrelationModel(LmCorrelationModel corrModel)
     : base(corrModel.size(), 0)
 {
     corrModel_ = corrModel;
 }