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


C++ matrix::size1方法代码示例

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


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

示例1:

bool
MappedImage::merge( const boost::numeric::ublas::matrix<uint16_t>& frame, unsigned low, unsigned high )
{
    if ( frame.size1() != impl_->data_.size1() || frame.size2() != impl_->data_.size2() ) {
        // dimension mismatch
        impl_->data_.resize( frame.size1(), frame.size2() );
        impl_->data_.clear();
        impl_->mergeCount_ = 0;
    }

    for ( size_t i = 0; i < frame.size1(); ++i ) {
        for ( size_t j = 0; j < frame.size2(); ++j ) {

            if ( auto tof = frame(i, j) ) { // has hit
                if ( low <= tof && tof <= high ) {
                    impl_->data_( i, j ) += 1.0;
                    impl_->z_ = std::max( impl_->z_, impl_->data_( i, j ) );
                }
            }
            
        }
    }
    impl_->mergeCount_++;
    return true;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: det_chol

    double det_chol(const ublas::matrix<double,F,A> &m)
	// Compute determinant of Cholesky matrix. 
    {
        assert(m.size1() == m.size2());
        double d = 1.;
        for (size_t i=0; i < m.size1(); ++i)
            d *= m(i,i);
        return d;
    }
开发者ID:Aaaaaaare,项目名称:beliefbox,代码行数:9,代码来源:cholesky.hpp

示例3: diameter

double diameter(const ublas::matrix<double>& D)
{
  double total = 0;
  for(int i=0;i<D.size1();i++)
    for(int j=0;j<i;j++)
      total += D(i,j);
  
  int N = D.size1() * (D.size1() - 1) /2;

  return total/N;
}
开发者ID:sibonli,项目名称:BAli-Phy,代码行数:11,代码来源:alignment-median.C

示例4: determinant

double determinant( bnu::matrix<double>& m ) {
    bnu::permutation_matrix<std ::size_t> pm(m.size1());
    double det = 1.0;
    if( bnu::lu_factorize(m,pm) ) {
        det = 0.0;
    } else {
        for(int i = 0; i < m.size1(); i++)
            det *= m(i,i); // multiply by elements on diagonal
        det = det * determinant_sign( pm );
    }
    return det;
}
开发者ID:zernexz,项目名称:posys2,代码行数:12,代码来源:invert_matrix.hpp

示例5: is_symmetric

	bool is_symmetric(const ublas::matrix<double, F, A> &m)
	{
		if (m.size1() != m.size2())
			return false;

		for (size_t i = 0; i < m.size1(); ++i)
			for (size_t j = i+1; j < m.size2(); ++j)
				if (m(i,j) != m(j,i))
					return false;

		return true;
	}
开发者ID:Aaaaaaare,项目名称:beliefbox,代码行数:12,代码来源:symmetry.hpp

示例6: createImgMap

cv::Mat Bridge::createImgMap(const boost::numeric::ublas::matrix<STATE> &groundMap) {
    cv::Mat ground(groundMap.size1(), groundMap.size2(), CV_8UC3, cv::Scalar(0, 0, 0));
    for (unsigned int i = 0; i < groundMap.size1(); ++i) {
        for (unsigned int j = 0; j < groundMap.size2(); ++j) {
            if (groundMap(i, j) == 0) {
                ground.at<cv::Vec3b>(i, j) = cv::Vec3b(0, 0, 0);
            } else {
                ground.at<cv::Vec3b>(i, j) = cv::Vec3b(255, 255, 255);
            }
        }
    }
    return ground;
}
开发者ID:Ernyoke,项目名称:VREP_Pathfinding,代码行数:13,代码来源:Bridge.cpp

示例7: pprint

      void pprint(const boost::numeric::ublas::matrix<double>& m) {
	cout << "[";
	for( uint r=0; r < m.size1(); r++) {
	  for( uint c=0; c < m.size2(); c++) {
	    cout << m(r,c);
	    if(c == m.size2()-1 && r != m.size1()-1) 
	      cout << "\n ";
	    else if(c != m.size2()-1)
	      cout << " , ";
	  }
	}
	cout << "]\n";
      }
开发者ID:bilian1995,项目名称:Delite,代码行数:13,代码来源:OptiML.hpp

示例8: equal

bool equal(boost::numeric::ublas::matrix<E> lhs, boost::numeric::ublas::matrix<E> rhs)
{
  if (&lhs == &rhs) { return true; }
  if (lhs.size1() != rhs.size1()) { return false; }
  if (lhs.size2() != rhs.size2()) { return false; }
  typename boost::numeric::ublas::matrix<E>::iterator1 l(lhs.begin1());
  typename boost::numeric::ublas::matrix<E>::iterator1 r(rhs.begin1());
  while (l != lhs.end1()) {
    if (*l != *r) { return false; }
    ++l;
    ++r;
  }
  return true;
}
开发者ID:BerndSchwarzenbacher,项目名称:Graph-Laplacian,代码行数:14,代码来源:test_graph_laplacian.cpp

示例9: throw

	FixedMatrix( const boost::numeric::ublas::matrix<TYPE> &boost_matrix ) throw ( std::logic_error & ) {
		if( boost_matrix.size1() == ROWS && boost_matrix.size2() == COLS ) {
			for( size_t m = 0; m < ROWS; m++ ) {
				for( size_t n = 0; n < COLS; n++ ) {
					this->elem( n, m ) = boost_matrix( m, n );
				}
			}
		} else {
			LOG( Runtime, error ) << "The size of the boost matrix ("
								  << boost_matrix.size1() << ", " << boost_matrix.size2()
								  << ") does not coincide with the size of the isis matrix (" << ROWS << ", " << COLS << ").";
			throw( std::logic_error( "Size mismatch" ) );
		}
	};
开发者ID:Rollmops,项目名称:isis,代码行数:14,代码来源:matrix.hpp

示例10: determineRowOfFace

int SAFForwardingTable::determineRowOfFace(int face_id, boost::numeric::ublas::matrix<double> tab, std::vector<int> faces)
{
  // check if table fits to faces
  if(tab.size1 () != faces.size ())
  {
    fprintf(stderr, "Error the number of faces dont correspond to the table!\n");
    return FACE_NOT_FOUND;
  }

  if(std::find(faces.begin (), faces.end (), face_id) == faces.end ())
  {
    fprintf(stderr, "Face Not Found!!!\n");
    return FACE_NOT_FOUND;
  }

  //determine row of face
  int faceRow = FACE_NOT_FOUND;
  std::sort(faces.begin(), faces.end());//order

  int rowCounter = 0;
  for(std::vector<int>::iterator i = faces.begin (); i != faces.end() ; ++i)
  {
    //fprintf(stderr, "*i=%d ; face_id=%d\n",*i,face_id);
    if(*i == face_id)
    {
      faceRow = rowCounter;
      break;
    }
    rowCounter++;
  }
  return faceRow;
}
开发者ID:danposch,项目名称:NFD,代码行数:32,代码来源:safforwardingtable.cpp

示例11: i

    boost::array<WorkingType, ValDim>
    interpolate(const boost::array<WorkingType, PosDim> &position) const
    {
      boost::array<WorkingType, ValDim> result;
      // Init result
      for(int j(0); j < ValDim; ++j)
        result[j] = 0;

      unsigned int i(0);
      for(; i < Wa.size1() - (PosDim+1); ++i)
      {
        for(int j(0); j < ValDim; ++j)
          result[j] += Wa(i,j) * radialbasis<WorkingType, WorkingType, PosDim>(refPositions[i], position);
      }

      for(int j(0); j < ValDim; ++j)
        result[j] += Wa(i,j);
      ++i;

      for(int k(0); k < PosDim; ++k, ++i)
      {
        for(int j(0); j < ValDim; ++j)
          result[j] += Wa(i,j) * position[k];
      }
      return result;
    }
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:26,代码来源:TPSInterpolate.hpp

示例12: force_symmetry

	void force_symmetry(ublas::matrix<double, F, A> &m, const bool upperToLower=true)
	// Make matrix symmetric by copying upper-to-lower (default) or lower-to-upper.
	{
		if (m.size1() != m.size2())
			throw LogicalError(ERROR_INFO("Matrix is not square"));

		if (upperToLower) {
            for (size_t i = 0; i < m.size1(); ++i)
				for (size_t j = i+1; j < m.size2(); ++j)
					m(j,i) = m(i,j);
		}
		else {
            for (size_t i = 0; i < m.size1(); ++i)
				for (size_t j = i+1; j < m.size2(); ++j)
					m(i,j) = m(j,i);
		}
	}
开发者ID:Aaaaaaare,项目名称:beliefbox,代码行数:17,代码来源:symmetry.hpp

示例13: parallel_jacob_musictest

void parallel_jacob_musictest(boost::numeric::ublas::matrix<float> M, std::string isWriteToConsole, std::ofstream fp_outs[1], int i) {
	int iter;
	auto begin = std::chrono::high_resolution_clock::now();
	auto end = std::chrono::high_resolution_clock::now();

	double duration = 0;
	matrix* A = 0; 
	init_matrix(&A, M.size1());
	make_matrix(*A, M);
	std::vector<float> e;
	
	// BEGIN TEST
	begin = std::chrono::high_resolution_clock::now();
	find_eigenvalues_parallel_jacob_music(A, e, iter);
	end = std::chrono::high_resolution_clock::now();
	// END TEST
	std::sort(e.begin(), e.end());
	duration = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count() / 1000000.0;
	boost::numeric::ublas::vector<float> eigs(M.size1());
	for (size_t i = 0; i < e.size(); i++)
	{
		eigs(i) = e[i];
	}
	
	// INFO
	if (isWriteToConsole == "true") {
		std::string eig = "[";
		eig += std::to_string(M.size1());
		eig += "](";
		for (int i = 0; i < M.size1() - 1; i++)
		{
			eig += std::to_string(e[i]);
			eig += ",";
		}
		eig += std::to_string(e[M.size1() - 1]);
		eig += ")";

		writeToAllStreams((boost::format("#%1%: \n") % i).str(), fp_outs);

		writeToAllStreams((boost::format("Name: %1% \nEigenvalues: %2% \nElapsed(ms): %3% \nIter: %4%")
			% "parallel_jacob_music"% eig%duration%iter).str(), fp_outs);

		writeToAllStreams("============================", fp_outs);
	}
}
开发者ID:NikiforovAll,项目名称:JacobiEigenvalueAlgorithm,代码行数:45,代码来源:JacobiEigenvalueAlgorithm.cpp

示例14: fill_boost_matrix_from_munkres_matrix

void fill_boost_matrix_from_munkres_matrix (boost::numeric::ublas::matrix <T> & boost_matrix, const Matrix <T> & matrix)
{
    const int dimention = std::min (boost_matrix.size1 (), boost_matrix.size2 () );
    for (int i = 0; i < dimention; ++i) {
        for (int j = 0; j < dimention; ++j) {
            boost_matrix (i, j) = matrix (i, j);
        }
    }
};
开发者ID:buiksat,项目名称:aau_multi_robot,代码行数:9,代码来源:boost_matrix.cpp

示例15: summOffDiagonal2

double summOffDiagonal2(boost::numeric::ublas::matrix<double> &S) {
	double sum = 0;
	for (int i = 0; i < S.size1(); i++) {
		for (int j = i + 1; j < S.size2(); j++)
		{
			sum += abs(S(i, j));
		}
	}
	return sum;
}
开发者ID:NikiforovAll,项目名称:JacobiEigenvalueAlgorithm,代码行数:10,代码来源:Util.cpp


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