コード例 #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
ファイル: lfmcovarproxy.cs プロジェクト: scchess/QLNet
 public VarProxy_Helper(LfmCovarianceProxy proxy, int i, int j)
 {
     i_         = i;
     j_         = j;
     volaModel_ = proxy.volaModel_;
     corrModel_ = proxy.corrModel_;
 }
コード例 #3
0
ファイル: liborforwardmodel.cs プロジェクト: Yenyenx/qlnet
        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
ファイル: lfmcovarproxy.cs プロジェクト: scchess/QLNet
        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");
        }
コード例 #5
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");
        }
コード例 #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
ファイル: lfmcovarproxy.cs プロジェクト: akasolace/qlnet
 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;
 }