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


C++ InputType::size方法代码示例

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


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

示例1: operator

	int operator()(const InputType &x, ValueType& fvec) const {
		m_decoder.Decode(m_rots, x);

		Vector3 v = sik.endPosition(m_rots);
		v -= m_goal;
		fvec.setZero();
		fvec.head<3>() = Eigen::Vector3f::Map(&v.x);

		// limit-exceed panelaty
		auto limpanl = fvec.tail(x.size());
		for (int i = 0; i < x.size(); i++)
		{
			if (x[i] < m_min[i])
				limpanl[i] = m_limitPanalty*(x[i] - m_min[i])*(x[i] - m_min[i]);
			else if (x[i] > m_max[i])
				limpanl[i] = m_limitPanalty*(x[i] - m_max[i])*(x[i] - m_max[i]);
		}

		if (m_useRef)
		{
			limpanl += m_refWeights *(x - m_ref);
		}

		return 0;
	}
开发者ID:flair2005,项目名称:OpenAvataring,代码行数:25,代码来源:StylizedIK+-+Copy.cpp

示例2: df

	int df(const InputType &x, JacobianType& fjac) {
		m_decoder.Decode(m_rots, x);

		fjac.setZero();

		m_jacb.resize(3, 3 * n);
		sik.endPositionJaccobiRespectEuler(m_rots, 
			array_view<Vector3>(reinterpret_cast<Vector3*>(m_jacb.data()),3*n));

		m_decoder.EncodeJacobi(m_rots, m_jacb);

		fjac.topRows<3>() = m_jacb;//Eigen::Matrix3Xf::Map(&m_jac[0].x, 3, 3 * n);

		// limit-exceed panelaty
		for (int i = 0; i < x.size(); i++)
		{
			if (x[i] < m_min[i])
				fjac(3 + i, i) = m_limitPanalty * (x[i] - m_min[i]);
			else if (x[i] > m_max[i])
				fjac(3 + i, i) = m_limitPanalty * (x[i] - m_max[i]);

			if (m_useRef)
			{
				fjac(3 + i, i) += m_refWeights;
			}
		}

		return 0;
	}
开发者ID:flair2005,项目名称:OpenAvataring,代码行数:29,代码来源:StylizedIK+-+Copy.cpp

示例3: num_diff

 void num_diff(const boost::function<OutputType (const InputType& )>& f
             , const InputType& cur // current point
             , int m // output dimension
             , double epsilon
             , MatType* out
              ) {
   assert (out != nullptr);
   int n = cur.size();
   InputType x = cur;
   out->resize(m, n);
   for (int i = 0; i < n; ++i) {
     x(i) = cur(i) + epsilon;
     OutputType fplus = f(x);
     x(i) = cur(i) - epsilon;
     OutputType fminus = f(x);
     out->col(i) = (fplus - fminus) / (2 * epsilon);
     x(i) = cur(i);
   }
 }
开发者ID:panjia1983,项目名称:channel_backward,代码行数:19,代码来源:utils.hpp

示例4: GetCombinationsIterative

std::vector<std::vector<int>> GetCombinationsIterative(const std::vector<int>& input)
{
	typedef std::vector<std::vector<int>> ResultType;
	typedef std::vector<int> InputType;
	typedef std::vector<std::tuple<int, InputType>> ProblemType;
	typedef std::map<int, ProblemType> ProblemListType;
	typedef std::queue<InputType> LevelResultsType;

	ResultType result;
	
	ProblemListType problemTree;

	int currentLevel = input.size();
	int startLevel = currentLevel;
	problemTree[currentLevel] = ProblemType
	{ 
		std::tuple<int, InputType> {0, input}
	};
	InputType temp = input;
	int nodeNr = 1;
	while (currentLevel > 2)
	{
		problemTree[currentLevel - 1] = ProblemType{};
		const auto& nodes = problemTree[currentLevel];
		for (const auto& node : nodes)
		{
			temp = std::get<1>(node);
			for (const auto& element : temp)
			{
				std::vector<int> diffSet = temp;
				diffSet.erase(std::find(diffSet.begin(), diffSet.end(), element));
				problemTree[currentLevel - 1].push_back(std::make_tuple(element, diffSet));
			}
		}
		currentLevel = currentLevel - 1;
	}

	LevelResultsType resultsCurrentLevel;
	LevelResultsType resultsPreviousLevel;
	
	while (currentLevel < startLevel)
	{
		resultsCurrentLevel = {};
		const auto& nodes = problemTree[currentLevel];
		int partitionSize = currentLevel == 2 ? 2 : resultsPreviousLevel.size() / nodes.size();
		for (const auto& node : nodes)
		{
			temp = std::get<1>(node);
			if (temp.size() == 2)
			{
				resultsPreviousLevel.push({ temp[0], temp[1] });
				resultsPreviousLevel.push({ temp[1], temp[0] });
			}
			for (int i = 0; i < partitionSize ; ++i)
			{
				auto& previousLevelResult = resultsPreviousLevel.front();
				previousLevelResult.insert(previousLevelResult.begin(), std::get<0>(node));
				resultsCurrentLevel.push(resultsPreviousLevel.front());
				resultsPreviousLevel.pop();
			}
		}
		resultsPreviousLevel = resultsCurrentLevel;
		++currentLevel;
	}

	while (!resultsCurrentLevel.empty())
	{
		result.push_back(resultsCurrentLevel.front());
		resultsCurrentLevel.pop();
	}

	return result;
}
开发者ID:uabbas,项目名称:ProjectEuler,代码行数:73,代码来源:Problem24-LexicographicPermutations.cpp

示例5: switch

void mitk::GroupDiffusionHeadersFilter::Update()
{
  InputType input =  static_cast<InputType>( this->GetInput( ) );
  this->SetNthOutput(0, input);

  InputType dwi;
  InputType zerodwi;
  InputType other;

  bool foundDWI = false;

  // check each series' first image
  unsigned int size = input.size();
  HeaderPointer header;
  HeaderPointer dwiHeader;
  for ( unsigned int i = 0 ; i < size ; ++i )
  {
    header = input[i];

    // list of files
    if( header->bValue > 0)
    {
      header->headerGroup = DHG_NonZeroDiffusionWeighted;
      if(!foundDWI)
        dwiHeader = header;
      foundDWI = true;
    }
    else
    {
      header->headerGroup = DHG_ZeroDiffusionWeighted;
    }
  }

  if(foundDWI)
  {
    for ( unsigned int i = 0 ; i < size ; ++i )
    {
      header = input[i];

      // list of files
      if( !header->isIdentical(dwiHeader))
      {
        header->headerGroup = DHG_Other;
      }
    }
  }
  else
  {
    for ( unsigned int i = 0 ; i < size ; ++i )
    {
      header = input[i];
      header->headerGroup = DHG_Other;
    }
  }

  for ( unsigned int i = 0 ; i < size ; ++i )
  {
    header = input[i];
    
    switch (header->headerGroup)
    {
    case DHG_Other:
      other.push_back(header);
      break;
    case DHG_ZeroDiffusionWeighted:
      zerodwi.push_back(header);
      break;
    case DHG_NonZeroDiffusionWeighted:
      dwi.push_back(header);
      break;
    case DHG_NotYetGrouped:
      break;
    }
  }

  this->SetNthOutput(1, dwi);
  this->SetNthOutput(2, zerodwi);
  this->SetNthOutput(3, other);

}
开发者ID:test-fd301,项目名称:MITK,代码行数:80,代码来源:mitkGroupDiffusionHeadersFilter.cpp


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