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


C++ MatrixXf::columns方法代码示例

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


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

示例1: run

void run ()
{

  const double tol = argument[2];

#ifdef MRTRIX_UPDATED_API

  const Eigen::MatrixXf in1 = load_matrix<float> (argument[0]);
  const Eigen::MatrixXf in2 = load_matrix<float> (argument[1]);
  
  if (in1.rows() != in2.rows() || in1.cols() != in2.cols())
    throw Exception ("matrices \"" + Path::basename (argument[0]) + "\" and \"" + Path::basename (argument[1]) + "\" do not have matching sizes"
                     " (" + str(in1.rows()) + "x" + str(in1.cols()) + " vs " + str(in2.rows()) + "x" + str(in2.cols()) + ")");
  
  const size_t numel = in1.size();
  for (size_t i = 0; i != numel; ++i) {
    if (std::abs (*(in1.data()+i) - *(in2.data()+i)) > tol)
      throw Exception ("matrices \"" + Path::basename (argument[0]) + "\" and \"" + Path::basename (argument[1]) + " do not match within specified precision of " + str(tol)
                       + " (" + str(*(in1.data()+i)) + " vs " + str(*(in2.data()+i)) + ")");
  }
  
#else

  Math::Matrix<float> in1, in2;
  in1.load (argument[0]);
  in2.load (argument[1]);
  
  if (in1.rows() != in2.rows() || in1.columns() != in2.columns())
    throw Exception ("matrices \"" + Path::basename (argument[0]) + "\" and \"" + Path::basename (argument[1]) + "\" do not have matching sizes"
                     " (" + str(in1.rows()) + "x" + str(in1.columns()) + " vs " + str(in2.rows()) + "x" + str(in2.columns()) + ")");
            
  const size_t numel = in1.rows() * in1.columns();
  for (size_t i = 0; i != numel; ++i) {
    if (std::abs (*(in1.ptr()+i) - *(in2.ptr()+i)) > tol)
      throw Exception ("matrices \"" + Path::basename (argument[0]) + "\" and \"" + Path::basename (argument[1]) + " do not match within specified precision of " + str(tol)
                       + " (" + str(*(in1.ptr()+i)) + " vs " + str(*(in2.ptr()+i)) + ")");
  }               

#endif

  CONSOLE ("data checked OK");
}
开发者ID:jdtournier,项目名称:testing,代码行数:42,代码来源:testing_diff_matrix.cpp


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