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


C++ SmartPtr::GetNRowsAdded方法代码示例

本文整理汇总了C++中SmartPtr::GetNRowsAdded方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartPtr::GetNRowsAdded方法的具体用法?C++ SmartPtr::GetNRowsAdded怎么用?C++ SmartPtr::GetNRowsAdded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SmartPtr的用法示例。


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

示例1: GetSchurMatrix

  bool IndexPCalculator::GetSchurMatrix(const SmartPtr<const SchurData>& B, SmartPtr<Matrix>& S)
  {
    DBG_START_METH("IndexPCalculator::GetSchurMatrix", dbg_verbosity);
    bool retval = true;

    Number* S_values;
    if (!IsValid(S)) {
      if ( B==data_A() ) {
	SmartPtr<DenseSymMatrixSpace> S_sym_space = new DenseSymMatrixSpace(B->GetNRowsAdded());
	SmartPtr<DenseSymMatrix> dS = new DenseSymMatrix(GetRawPtr(S_sym_space));
	S_values = dS->Values();
	S = GetRawPtr(dS);
      }
      else {
	SmartPtr<DenseGenMatrixSpace> S_sym_space = new DenseGenMatrixSpace(B->GetNRowsAdded(), B->GetNRowsAdded());
	SmartPtr<DenseGenMatrix> dS = new DenseGenMatrix(GetRawPtr(S_sym_space));
	S_values = dS->Values();
	S = GetRawPtr(dS);
      }
    }
    else {
      // Try DenseGenMatrix - if NULL, try DenseSymMatrix
      SmartPtr<DenseGenMatrix> dS_gen = dynamic_cast<DenseGenMatrix*>(GetRawPtr(S));
      if (!IsValid(dS_gen)) {
	SmartPtr<DenseSymMatrix> dS_sym = dynamic_cast<DenseSymMatrix*>(GetRawPtr(S));
	S_values = dS_sym->Values();
      }
      else {
	S_values = dS_gen->Values();
      }
    }
    /*
      DenseGenMatrix* dS = static_cast<DenseGenMatrix*>(&S);
      DBG_ASSERT(dynamic_cast<const DenseGenMatrix*>(&S));
    */
    // Check whether data_A was changed from the outside
    if (ncols_!=data_A()->GetNRowsAdded()) {
      ncols_ = data_A()->GetNRowsAdded();
      ComputeP();
    }
    /*
      DBG_ASSERT(dS->NRows()==dS->NCols());
      DBG_ASSERT(dS->NRows()==data_A()->GetNRowsAdded());
    */
    std::vector<Index> indices;
    std::vector<Number> factors;

    // Compute S = B^T*P from indices, factors and P
    const std::vector<Index>* data_A_idx = dynamic_cast<const IndexSchurData*>(GetRawPtr(data_A()))->GetColIndices();
    const std::vector<Index>* data_B_idx = dynamic_cast<const IndexSchurData*>(GetRawPtr(B))->GetColIndices();
    Index col_count = 0;
    for (std::vector<Index>::const_iterator a_it=data_A_idx->begin(); a_it!=data_A_idx->end(); ++a_it) {
      cols_[*a_it]->GetSchurMatrixRows(data_B_idx, S_values+col_count*ncols_);
      col_count++;
    }
    return retval;
  }
开发者ID:liangboyun,项目名称:ipopt_wps,代码行数:57,代码来源:SensIndexPCalculator.cpp

示例2: PCalculator

  IndexPCalculator::IndexPCalculator(SmartPtr<SensBacksolver> backsolver,
				     SmartPtr<SchurData> A_data)
    :
    PCalculator(backsolver, A_data),
    nrows_(0),
    ncols_(A_data->GetNRowsAdded())
  {
    DBG_START_METH("IndexPCalculator::IndexPCalculator", dbg_verbosity);
  }
开发者ID:liangboyun,项目名称:ipopt_wps,代码行数:9,代码来源:SensIndexPCalculator.cpp


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