当前位置: 首页>>代码示例>>C++>>正文


C++ checkInputs函数代码示例

本文整理汇总了C++中checkInputs函数的典型用法代码示例。如果您正苦于以下问题:C++ checkInputs函数的具体用法?C++ checkInputs怎么用?C++ checkInputs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了checkInputs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ConvexCombinationRiskMeasure

  /** \brief Constructor.

      @param[in]     parlist is a parameter list specifying inputs

      parlist should contain sublists "SOL"->"Risk Measure"->"Convex Combination Risk Measure" and
      within the "Convex Combination Risk Measure" sublist should have the following parameters
      \li "Convex Combination Parameters" (greater than 0 and sum to 1)
      \li Sublists labeled 1 to n with risk measure definitions.
  */
  ConvexCombinationRiskMeasure(Teuchos::ParameterList &parlist)
    : RiskMeasure<Real>(), size_(0), firstReset_(true) {
    Teuchos::ParameterList &list
      = parlist.sublist("SOL").sublist("Risk Measure").sublist("Convex Combination Risk Measure");
    // Get convex combination parameters
    Teuchos::Array<Real> lambda
      = Teuchos::getArrayFromStringParameter<Real>(list,"Convex Combination Parameters");
    lambda_ = lambda.toVector();
    size_ = lambda_.size();
    // Build risk measures
    risk_.clear(); risk_.resize(size_,Teuchos::null);
    parlist_.clear(); parlist_.resize(size_);
    for (uint i = 0; i < size_; ++i) {
      std::ostringstream convert;
      convert << i;
      std::string si = convert.str();
      Teuchos::ParameterList &ilist = list.sublist(si);
      std::string name = ilist.get<std::string>("Name");
      parlist_[i].sublist("SOL").sublist("Risk Measure").set("Name",name);
      parlist_[i].sublist("SOL").sublist("Risk Measure").sublist(name) = ilist;
      risk_[i] = RiskMeasureFactory<Real>(parlist_[i]);
    }
    // Check inputs
    checkInputs();
  }
开发者ID:nschloe,项目名称:Trilinos,代码行数:34,代码来源:ROL_ConvexCombinationRiskMeasure.hpp

示例2: CapFloorTermVolatilityStructure

 // fixed reference date, fixed market data
 CapFloorTermVolSurface::CapFloorTermVolSurface(
                     const Date& settlementDate,
                     const Calendar& calendar,
                     BusinessDayConvention bdc,
                     const std::vector<Period>& optionTenors,
                     const std::vector<Rate>& strikes,
                     const Matrix& vols,
                     const DayCounter& dc)
 : CapFloorTermVolatilityStructure(settlementDate, calendar, bdc, dc),
   nOptionTenors_(optionTenors.size()),
   optionTenors_(optionTenors),
   optionDates_(nOptionTenors_),
   optionTimes_(nOptionTenors_),
   nStrikes_(strikes.size()),
   strikes_(strikes),
   volHandles_(vols.rows()),
   vols_(vols)
 {
     checkInputs();
     initializeOptionDatesAndTimes();
     // fill dummy handles to allow generic handle-based computations later
     for (Size i=0; i<nOptionTenors_; ++i) {
         volHandles_[i].resize(nStrikes_);
         for (Size j=0; j<nStrikes_; ++j)
             volHandles_[i][j] = Handle<Quote>(boost::shared_ptr<Quote>(new
                 SimpleQuote(vols_[i][j])));
     }
     interpolate();
 }
开发者ID:21hub,项目名称:QuantLib,代码行数:30,代码来源:capfloortermvolsurface.cpp

示例3: mexFunction

///////////////////////////////////////////////////////////////////////////
// Main entry point to a MEX function
///////////////////////////////////////////////////////////////////////////
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{  
    // Ensure MATLAB's GPU support is available.
    mxInitGPU();

    // Check inputs to mex function
    checkInputs(nrhs, prhs);
     
    // Convert mxArray inputs into OpenCV types
    cv::Ptr<cv::gpu::GpuMat> frame1 = ocvMxGpuArrayToGpuMat_uint8(prhs[0]);
    cv::Ptr<cv::gpu::GpuMat> frame2 = ocvMxGpuArrayToGpuMat_uint8(prhs[1]);

    // Allocate output matrix
    int outRows = frame1->rows ;
    int outCols = frame1->cols ;

    cv::gpu::GpuMat flowx((int)outRows, (int)outCols, CV_32FC1);
    cv::gpu::GpuMat flowy((int)outRows, (int)outCols, CV_32FC1);
    cv::gpu::FarnebackOpticalFlow d_calc;
    // Run the OpenCV template matching routine
    d_calc(*frame1, *frame2, flowx,  flowy);

    // Put the data back into the output MATLAB gpuArray
    plhs[0] = ocvMxGpuArrayFromGpuMat_single(flowx);
    plhs[1] = ocvMxGpuArrayFromGpuMat_single(flowy);
    
}
开发者ID:bennix,项目名称:fishtrackercnn,代码行数:30,代码来源:FarnebackOpticalFlow_GPU.cpp

示例4: gesv

// Supports arbitrary batch dimensions for self and A
std::tuple<Tensor,Tensor> gesv(const Tensor& self, const Tensor& A) {
  if (self.dim() <= 2 && A.dim() <= 2) {
    // TODO: #7102: It's not necessary to have gesv (single) bindings for both
    // TH and ATen. We should remove the TH gesv bindings, especially
    // since the lapackGesv function is already in ATen.
    return at::_gesv_single(self, A);
  }

  checkInputs(self, A);

  // broadcast the batch dimensions of self and A.
  IntList self_batch_sizes(self.sizes().data(), self.ndimension() - 2);
  IntList A_batch_sizes(A.sizes().data(), A.ndimension() - 2);
  std::vector<int64_t> expand_batch_portion =
      infer_size(self_batch_sizes, A_batch_sizes);

  std::vector<int64_t> self_expand_size({expand_batch_portion});
  self_expand_size.insert(self_expand_size.end(),
      { self.size(-2), self.size(-1) });

  std::vector<int64_t> A_expand_size({expand_batch_portion});
  A_expand_size.insert(A_expand_size.end(),
      { A.size(-2), A.size(-1) });

  Tensor self_broadcasted  = self.expand(self_expand_size);
  Tensor A_broadcasted = A.expand(A_expand_size);
  return self.type()._gesv_helper(self_broadcasted, A_broadcasted);
}
开发者ID:gtgalone,项目名称:pytorch,代码行数:29,代码来源:Gesv.cpp

示例5: evaluate

  void SQICInternal::evaluate() {
    if (inputs_check_) checkInputs();

    std::copy(input(QP_SOLVER_X0).begin(), input(QP_SOLVER_X0).end(), x_.begin());
    std::fill(x_.begin()+n_, x_.end(), 0);

    std::transform(input(QP_SOLVER_LAM_X0).begin(), input(QP_SOLVER_LAM_X0).end(), rc_.begin(),
                   negate<double>());
    std::fill(rc_.begin()+n_, rc_.end(), 0);

    std::copy(input(QP_SOLVER_LBX).begin(), input(QP_SOLVER_LBX).end(), bl_.begin());
    std::copy(input(QP_SOLVER_UBX).begin(), input(QP_SOLVER_UBX).end(), bu_.begin());

    std::copy(input(QP_SOLVER_LBA).begin(), input(QP_SOLVER_LBA).end(), bl_.begin()+n_);
    std::copy(input(QP_SOLVER_UBA).begin(), input(QP_SOLVER_UBA).end(), bu_.begin()+n_);

    for (int i=0;i<n_+nc_+1;++i) {
      if (bl_[i]==-std::numeric_limits<double>::infinity()) bl_[i]=-inf_;
      if (bu_[i]==std::numeric_limits<double>::infinity()) bu_[i]=inf_;
    }

    formatA_.setInput(input(QP_SOLVER_A), 0);
    formatA_.setInput(input(QP_SOLVER_G), 1);
    formatA_.evaluate();

    sqicSolve(&output(QP_SOLVER_COST).data()[0]);

    std::copy(x_.begin(), x_.begin()+n_, output(QP_SOLVER_X).begin());
    std::transform(rc_.begin(), rc_.begin()+n_, output(QP_SOLVER_LAM_X).begin(), negate<double>());
    std::transform(rc_.begin()+n_, rc_.begin()+n_+nc_, output(QP_SOLVER_LAM_A).begin(),
                   negate<double>());

    output(QP_SOLVER_COST)[0]+= x_[n_+nc_];
  }
开发者ID:tmmsartor,项目名称:casadi,代码行数:34,代码来源:sqic_internal.cpp

示例6: checkInputs

SceneType MainCharacter::animate(Scene &scene, float delta) {
    checkInputs();
    move(scene, delta);
    createTransformationMatrix();

    return scene.sceneType;
}
开发者ID:nemcek,项目名称:Pokemon-3D,代码行数:7,代码来源:MainCharacter.cpp

示例7: SwaptionVolatilityDiscrete

 // fixed reference date, floating market data
 SwaptionVolatilityMatrix::SwaptionVolatilityMatrix(
                 const Date& refDate,
                 const Calendar& cal,
                 BusinessDayConvention bdc,
                 const std::vector<Period>& optionT,
                 const std::vector<Period>& swapT,
                 const std::vector<std::vector<Handle<Quote> > >& vols,
                 const DayCounter& dc,
                 const bool flatExtrapolation,
                 const std::vector<std::vector<Real> >& shifts)
 : SwaptionVolatilityDiscrete(optionT, swapT, refDate, cal, bdc, dc),
   volHandles_(vols), shiftValues_(shifts),
   volatilities_(vols.size(), vols.front().size()),
   shifts_(vols.size(), vols.front().size(), 0.0) {
     checkInputs(volatilities_.rows(), volatilities_.columns(),
                 shifts.size(), shifts.size() == 0 ? 0 : shifts.front().size());
     registerWithMarketData();
     if (flatExtrapolation) {
         interpolation_ =
             FlatExtrapolator2D(boost::make_shared<BilinearInterpolation>(
                 swapLengths_.begin(), swapLengths_.end(),
                 optionTimes_.begin(), optionTimes_.end(), volatilities_));
         interpolationShifts_ =
             FlatExtrapolator2D(boost::make_shared<BilinearInterpolation>(
                 swapLengths_.begin(), swapLengths_.end(),
                 optionTimes_.begin(), optionTimes_.end(), shifts_));
     } else {
         interpolation_ = BilinearInterpolation(
             swapLengths_.begin(), swapLengths_.end(), optionTimes_.begin(),
             optionTimes_.end(), volatilities_);
         interpolationShifts_ = BilinearInterpolation(
             swapLengths_.begin(), swapLengths_.end(), optionTimes_.begin(),
             optionTimes_.end(), shifts_);
     }
 }
开发者ID:fder78,项目名称:MyQuantLib,代码行数:36,代码来源:swaptionvolmatrix.cpp

示例8: ExpUtility

    /** \brief Constructor.

        @param[in]     parlist is a parameter list specifying inputs

        parlist should contain sublists "SOL"->"Risk Measures"->"Exponential Utility"
        and withing the "Exponential Utility" sublist should have
        \li "Rate" (greater than 0).
    */
    ExpUtility(Teuchos::ParameterList &parlist)
        : RiskMeasure<Real>(), firstReset_(true) {
        Teuchos::ParameterList &list
            = parlist.sublist("SOL").sublist("Risk Measure").sublist("Exponential Utility");
        coeff_ = list.get<Real>("Rate");
        checkInputs();
    }
开发者ID:uppatispr,项目名称:trilinos-official,代码行数:15,代码来源:ROL_ExpUtility.hpp

示例9: LogExponentialQuadrangle

  /** \brief Constructor.

      @param[in]     parlist is a parameter list specifying inputs

      parlist should contain sublists "SOL"->"Risk Measures"->"Log-Exponential Quadrangle"
      and withing the "Log-Exponential Quadrangle" sublist should have
      \li "Rate" (greater than 0). 
  */
  LogExponentialQuadrangle(Teuchos::ParameterList &parlist)
    : ExpectationQuad<Real>() {
    Teuchos::ParameterList &list
      = parlist.sublist("SOL").sublist("Risk Measure").sublist("Log-Exponential Quadrangle");
    coeff_ = list.get<Real>("Rate");
    checkInputs();
  }
开发者ID:cihanuq,项目名称:Trilinos,代码行数:15,代码来源:ROL_LogExponentialQuadrangle.hpp

示例10: checkInputs

stList *getMatchingWithCyclicConstraints(stSortedSet *nodes,
        stList *adjacencyEdges, stList *stubEdges, stList *chainEdges,
        bool makeStubCyclesDisjoint,
        stList *(*matchingAlgorithm)(stList *edges, int64_t nodeNumber)) {
    /*
     * Check the inputs.
     */
    checkInputs(nodes, adjacencyEdges, stubEdges, chainEdges);
    st_logDebug("Checked the inputs\n");

    if (stSortedSet_size(nodes) == 0) { //Some of the following functions assume there are at least 2 nodes.
        return stList_construct();
    }

    stList *chosenEdges = getPerfectMatching(nodes, adjacencyEdges, matchingAlgorithm);

    stSortedSet *allAdjacencyEdges = stList_getSortedSet(adjacencyEdges,
                (int(*)(const void *, const void *)) stIntTuple_cmpFn);
    stList *nonZeroWeightAdjacencyEdges = getEdgesWithGreaterThanZeroWeight(
                    adjacencyEdges);

    stList *updatedChosenEdges = makeMatchingObeyCyclicConstraints(nodes, chosenEdges, allAdjacencyEdges, nonZeroWeightAdjacencyEdges, stubEdges, chainEdges, makeStubCyclesDisjoint);
    stList_destruct(chosenEdges);
    chosenEdges = updatedChosenEdges;

    stList_destruct(nonZeroWeightAdjacencyEdges);
    stSortedSet_destruct(allAdjacencyEdges);

    return chosenEdges;
}
开发者ID:benedictpaten,项目名称:matchingAndOrdering,代码行数:30,代码来源:cycleConstraintMatchingAlgorithms.c

示例11: reversion_

    // floating reference date, fixed market data
    SwaptionVolatilityHullWhite::SwaptionVolatilityHullWhite(const Real reversion, const Handle<YieldTermStructure>& yts, const boost::shared_ptr<SwapIndex> indexBase,
                        const Calendar& cal,
                        BusinessDayConvention bdc,
                        const std::vector<Period>& optionT,
                        const std::vector<Period>& swapT,
                        const Matrix& vols,
                        const DayCounter& dc)
    : reversion_(reversion),yts_(yts),indexBase_(indexBase),SwaptionVolatilityDiscrete(optionT, swapT, 0, cal, bdc, dc),
      volHandles_(vols.rows()),
      hwsigmas_(vols.rows(), vols.columns()),
	  volatilities_(vols.rows(), vols.columns()) {

        checkInputs(vols.rows(), vols.columns());

        // fill dummy handles to allow generic handle-based
        // computations later on
        for (Size i=0; i<vols.rows(); ++i) {
            volHandles_[i].resize(vols.columns());
            for (Size j=0; j<vols.columns(); ++j)
                volHandles_[i][j] = Handle<Quote>(boost::shared_ptr<Quote>(new
                    SimpleQuote(vols[i][j])));
        }
        interpolation_ =
            BilinearInterpolation(swapLengths_.begin(), swapLengths_.end(),
                                  optionTimes_.begin(), optionTimes_.end(),
                                  volatilities_);
		interpolationSigma_ =
			BilinearInterpolation(swapLengths_.begin(), swapLengths_.end(),
                                  optionTimes_.begin(), optionTimes_.end(),
                                  hwsigmas_);
    }
开发者ID:cathie912jin,项目名称:quantlib,代码行数:32,代码来源:swaptionvolhullwhite.cpp

示例12: MixedQuantileQuadrangle

 MixedQuantileQuadrangle(const std::vector<Real> &prob,
                         const std::vector<Real> &coeff,
                         const Teuchos::RCP<PlusFunction<Real> > &pf )
   : RiskMeasure<Real>(), plusFunction_(pf), prob_(prob), coeff_(coeff), firstReset_(true) {
   checkInputs();
   initialize();
 }
开发者ID:mhoemmen,项目名称:Trilinos,代码行数:7,代码来源:ROL_MixedQuantileQuadrangle.hpp

示例13: BlackAtmVolCurve

 // floating reference date, floating market data
 AbcdAtmVolCurve::AbcdAtmVolCurve(
         Natural settlDays,
         const Calendar& cal,
         const std::vector<Period>& optionTenors,
         const std::vector<Handle<Quote> >& volsHandles,
         const std::vector<bool> inclusionInInterpolationFlag,
         BusinessDayConvention bdc,
         const DayCounter& dc)
 : BlackAtmVolCurve(settlDays, cal, bdc, dc),
   nOptionTenors_(optionTenors.size()),
   optionTenors_(optionTenors),
   optionDates_(nOptionTenors_),
   optionTimes_(nOptionTenors_),
   actualOptionTimes_(nOptionTenors_),
   volHandles_(volsHandles),
   vols_(volsHandles.size()),
   actualVols_(volsHandles.size()),
   inclusionInInterpolation_(inclusionInInterpolationFlag),
   interpolation_(boost::shared_ptr<AbcdInterpolation>()) // do not initialize with nOptionTenors_
 {
     checkInputs();
     initializeOptionDatesAndTimes();
     initializeVolatilities();
     registerWithMarketData();
     for (Size i=0; i<vols_.size(); ++i)
         vols_[i] = volHandles_[i]->value();
     interpolate();
 }
开发者ID:21hub,项目名称:QuantLib,代码行数:29,代码来源:abcdatmvolcurve.cpp

示例14: SingletonKusuoka

 SingletonKusuoka( const std::vector<Real> &pts, const std::vector<Real> &wts,
                   const Teuchos::RCP<PlusFunction<Real> > &pf)
   : RiskMeasure<Real>() {
   buildMixedQuantile(pts,wts,pf);
   // Check inputs
   checkInputs();
 }
开发者ID:uppatispr,项目名称:trilinos-official,代码行数:7,代码来源:ROL_SingletonKusuoka.hpp

示例15: MeanVarianceQuadrangle

  /** \brief Constructor.

      @param[in]     parlist is a parameter list specifying inputs

      parlist should contain sublists "SOL"->"Risk Measure"->"Mean-Variance Quadrangle" and
      within the "Mean-Variance Quadrangle" sublist should have the following parameters
      \li "Coefficient" (array of positive scalars).
  */
  MeanVarianceQuadrangle(Teuchos::ParameterList &parlist)
    : ExpectationQuad<Real>() {
    Teuchos::ParameterList &list
      = parlist.sublist("SOL").sublist("Risk Measure").sublist("Mean-Variance Quadrangle");
    coeff_ = list.get<Real>("Coefficient");
    checkInputs();
  }
开发者ID:cihanuq,项目名称:Trilinos,代码行数:15,代码来源:ROL_MeanVarianceQuadrangle.hpp


注:本文中的checkInputs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。