• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MatrixXd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DQ_controller

DampedNumericalFilteredController::DampedNumericalFilteredController(DQ_kinematics robot, MatrixXd kp, double beta, double lambda_max, double epsilon) : DQ_controller()
{
    //Constants
    dq_one_ = DQ(1);

    //Initialization of argument parameters
    robot_dofs_     = (robot.links() - robot.n_dummy());
    robot_          = robot;
    kp_             = kp;
    ki_             = MatrixXd::Zero(kp.rows(),kp.cols());
    kd_             = MatrixXd::Zero(kp.rows(),kp.cols());
    beta_           = beta;
    lambda_max_     = lambda_max;

    //Initilization of remaining parameters
    thetas_         = MatrixXd(robot_dofs_,1);
    delta_thetas_   = MatrixXd::Zero(robot_dofs_,1);

    task_jacobian_      = MatrixXd(8,robot_dofs_);
    svd_                = JacobiSVD<MatrixXd>(robot_dofs_,8);
    svd_sigma_inverted_ = MatrixXd::Zero(robot_dofs_,8);
    identity_           = Matrix<double,8,8>::Identity();

    error_              = MatrixXd::Zero(8,1);
    integral_error_     = MatrixXd::Zero(8,1);
    last_error_         = MatrixXd::Zero(8,1);
    at_least_one_error_ = false;

    end_effector_pose_ = DQ(0,0,0,0,0,0,0,0);

}
开发者ID:BIRLRobotSense,项目名称:birl_baxter,代码行数:31,代码来源:DampedNumericalFilteredController.cpp


示例2: test_eigensolver_selfadjoint

void test_eigensolver_selfadjoint()
{
  int s = 0;
  for(int i = 0; i < g_repeat; i++) {
    // very important to test 3x3 and 2x2 matrices since we provide special paths for them
    CALL_SUBTEST_1( selfadjointeigensolver(Matrix2f()) );
    CALL_SUBTEST_1( selfadjointeigensolver(Matrix2d()) );
    CALL_SUBTEST_1( selfadjointeigensolver(Matrix3f()) );
    CALL_SUBTEST_1( selfadjointeigensolver(Matrix3d()) );
    CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(s,s)) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(s,s)) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_5( selfadjointeigensolver(MatrixXcd(s,s)) );

    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_9( selfadjointeigensolver(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(s,s)) );

    // some trivial but implementation-wise tricky cases
    CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(1,1)) );
    CALL_SUBTEST_4( selfadjointeigensolver(MatrixXd(2,2)) );
    CALL_SUBTEST_6( selfadjointeigensolver(Matrix<double,1,1>()) );
    CALL_SUBTEST_7( selfadjointeigensolver(Matrix<double,2,2>()) );
  }

  // Test problem size constructors
  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
  CALL_SUBTEST_8(SelfAdjointEigenSolver<MatrixXf> tmp1(s));
  CALL_SUBTEST_8(Tridiagonalization<MatrixXf> tmp2(s));

  TEST_SET_BUT_UNUSED_VARIABLE(s)
}
开发者ID:aeslaughter,项目名称:libmesh,代码行数:34,代码来源:eigensolver_selfadjoint.cpp


示例3: forwardMatrixIterative

/**
 * @brief likelyhood : method to compute the log
 *                     likeyhood of observed sequence
 * @param sequence    :input observation sequence
 * @return
 */
float ocv::CHMM::predictIterative(Mat sequence,bool init)
{

    //computing the probability of observed sequence
    //using forward algorithm

    if(init==true)
    {
        count=0;
        prob=0;
        _alpha=MatrixXd(_nstates,_maxseqlen);
        _scale=MatrixXd(1,_maxseqlen);

    }
    int i=count;

      forwardMatrixIterative(sequence,init,i);
      prob=(_scale(0,i));

      //prob=-prob;
      //cerr << prob <<":" << count <<"--";
    count=count+1;

    return prob;
}
开发者ID:BLiuBLiu,项目名称:OpenVision,代码行数:31,代码来源:hmm.cpp


示例4: test_eigensolver_generic

void test_eigensolver_generic()
{
  int s = 0;
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_1( eigensolver(Matrix4f()) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) );

    // some trivial but implementation-wise tricky cases
    CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) );
    CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) );
    CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) );
    CALL_SUBTEST_4( eigensolver(Matrix2d()) );
  }

  CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) );
  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
  CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) );
  CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<double,1,1>()) );
  CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) );

  // Test problem size constructors
  CALL_SUBTEST_5(EigenSolver<MatrixXf> tmp(s));

  // regression test for bug 410
  CALL_SUBTEST_2(
  {
     MatrixXd A(1,1);
     A(0,0) = std::sqrt(-1.);
     Eigen::EigenSolver<MatrixXd> solver(A);
     MatrixXd V(1, 1);
     V(0,0) = solver.eigenvectors()(0,0).real();
  }
  );
开发者ID:b3sigma,项目名称:eigen,代码行数:34,代码来源:eigensolver_generic.cpp


示例5: MatrixXd

void LDA::gibbs(int K,double alpha,double beta) {

    this->K=K;
    this->alpha=alpha;
    this->beta=beta;

    if(SAMPLE_LAG >0) {
        thetasum = MatrixXd(documentsSize(),K);
        phisum= MatrixXd(K,V);
        numstats=0;
    }

    initialState(K);

    for(int i=0; i<ITERATIONS; i++) {
        for(int m=0; m<z.rows(); m++) {
            for(int n=0; n<z.cols(); n++) {
                z(m,n)=sampleFullConditional(m,n);
            }
        }
        if(i > BURN_IN && (i%THIN_INTERVAL==0)) {
            dispcol++;
        }
        if ((i > BURN_IN) && (SAMPLE_LAG > 0) && (i % SAMPLE_LAG == 0)) {
            updateParams();
            if (i % THIN_INTERVAL != 0)
                dispcol++;
        }
        if (dispcol >= 100) {
            dispcol = 0;
        }
    }
}
开发者ID:luxox20,项目名称:GPregression,代码行数:33,代码来源:lda.cpp


示例6: test_eigensolver_generic

void test_eigensolver_generic()
{
  int s = 0;
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_1( eigensolver(Matrix4f()) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) );
    TEST_SET_BUT_UNUSED_VARIABLE(s)

    // some trivial but implementation-wise tricky cases
    CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) );
    CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) );
    CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) );
    CALL_SUBTEST_4( eigensolver(Matrix2d()) );
  }

  CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) );
  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
  CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) );
  CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<double,1,1>()) );
  CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) );

  // Test problem size constructors
  CALL_SUBTEST_5(EigenSolver<MatrixXf> tmp(s));

  // regression test for bug 410
  CALL_SUBTEST_2(
  {
     MatrixXd A(1,1);
     A(0,0) = std::sqrt(-1.); // is Not-a-Number
     Eigen::EigenSolver<MatrixXd> solver(A);
     VERIFY_IS_EQUAL(solver.info(), NumericalIssue);
  }
  );
开发者ID:Aerobota,项目名称:eigen,代码行数:34,代码来源:eigensolver_generic.cpp


示例7: x0

void CVMath::setupMatrixM1()
{
	Line r1 = Points::getInstance().getR1();
	Line r2 = Points::getInstance().getR2();
	Line r3 = Points::getInstance().getR3();
	Line r4 = Points::getInstance().getR4();
	
	l0 << r1.x, r1.y, r1.z;
	l1 << r2.x, r2.y, r2.z;
	l2 << r3.x, r3.y, r3.z;
	l3 << r4.x, r4.y, r4.z;

	x0 = l0.cross(l1);
	x0 << x0(0)/x0(2), x0(1)/x0(2), 1;
	x1 = l2.cross(l3);
	x1 << x1(0)/x1(2), x1(1)/x1(2), 1;

	l =  x0.cross(x1);

	Hp = MatrixXd(3, 3);
	Hp << 1, 0, 0,
	     0, 1, 0,
	     l(0), l(1), l(2);
	std::cout << Hp << std::endl;
	Vector3d l0;
	Vector3d l1;
	Hp_INV = MatrixXd(3, 3);
	Hp_INV = Hp.inverse().eval();
	std::cout << Hp_INV << std::endl;
}
开发者ID:rprata,项目名称:computer-vision,代码行数:30,代码来源:CVMath.cpp


示例8: test_determinant

void test_determinant()
{
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_1( determinant(Matrix<float, 1, 1>()) );
    CALL_SUBTEST_2( determinant(Matrix<double, 2, 2>()) );
    CALL_SUBTEST_3( determinant(Matrix<double, 3, 3>()) );
    CALL_SUBTEST_4( determinant(Matrix<double, 4, 4>()) );
    CALL_SUBTEST_5( determinant(Matrix<std::complex<double>, 10, 10>()) );
    CALL_SUBTEST_6( determinant(MatrixXd(20, 20)) );
  }
  CALL_SUBTEST_6( determinant(MatrixXd(200, 200)) );
}
开发者ID:daviddoria,项目名称:QP,代码行数:12,代码来源:determinant.cpp


示例9: test_matrix_power

void test_matrix_power()
{
  CALL_SUBTEST_2(test2dRotation<double>(1e-13));
  CALL_SUBTEST_1(test2dRotation<float>(2e-5));  // was 1e-5, relaxed for clang 2.8 / linux / x86-64
  CALL_SUBTEST_9(test2dRotation<long double>(1e-13)); 
  CALL_SUBTEST_2(test2dHyperbolicRotation<double>(1e-14));
  CALL_SUBTEST_1(test2dHyperbolicRotation<float>(1e-5));
  CALL_SUBTEST_9(test2dHyperbolicRotation<long double>(1e-14));

  CALL_SUBTEST_10(test3dRotation<double>(1e-13));
  CALL_SUBTEST_11(test3dRotation<float>(1e-5));
  CALL_SUBTEST_12(test3dRotation<long double>(1e-13));

  CALL_SUBTEST_2(testGeneral(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testGeneral(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testGeneral(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testGeneral(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testGeneral(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testGeneral(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testGeneral(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testGeneral(MatrixXf(2,2),      1e-3)); // see bug 614
  CALL_SUBTEST_9(testGeneral(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testGeneral(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testGeneral(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testGeneral(Matrix3e(),        1e-13));

  CALL_SUBTEST_2(testSingular(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testSingular(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testSingular(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testSingular(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testSingular(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testSingular(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testSingular(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testSingular(MatrixXf(2,2),      1e-3));
  CALL_SUBTEST_9(testSingular(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testSingular(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testSingular(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testSingular(Matrix3e(),        1e-13));

  CALL_SUBTEST_2(testLogThenExp(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testLogThenExp(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testLogThenExp(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testLogThenExp(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testLogThenExp(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testLogThenExp(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testLogThenExp(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testLogThenExp(MatrixXf(2,2),      1e-3));
  CALL_SUBTEST_9(testLogThenExp(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testLogThenExp(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testLogThenExp(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testLogThenExp(Matrix3e(),        1e-13));
}
开发者ID:EVERTims,项目名称:auralization_engine_evertims,代码行数:52,代码来源:matrix_power.cpp


示例10: test_eigen2_eigensolver

void test_eigen2_eigensolver()
{
  for(int i = 0; i < g_repeat; i++) {
    // very important to test a 3x3 matrix since we provide a special path for it
    CALL_SUBTEST_1( selfadjointeigensolver(Matrix3f()) );
    CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) );
    CALL_SUBTEST_3( selfadjointeigensolver(MatrixXf(7,7)) );
    CALL_SUBTEST_4( selfadjointeigensolver(MatrixXcd(5,5)) );
    CALL_SUBTEST_5( selfadjointeigensolver(MatrixXd(19,19)) );

    CALL_SUBTEST_6( eigensolver(Matrix4f()) );
    CALL_SUBTEST_5( eigensolver(MatrixXd(17,17)) );
  }
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:14,代码来源:eigen2_eigensolver.cpp


示例11: moved_I

Derived lidarBoostEngine::apply_optical_flow(const MatrixBase<Derived>& I, std::vector< Derived > uv)
{
    Derived moved_I(beta*n, beta*m);
//    W = SparseMatrix<double>( beta*n, beta*m );
//    W.reserve(VectorXi::Constant(n, m));
//    T = SparseMatrix<double>( beta*n, beta*m );

//    MatrixXi W( beta*n, beta*m ), T( beta*n, beta*m );
    W = MatrixXd( beta*n, beta*m );

    int new_i, new_j;

    for( int i = 0; i < I.rows(); i++ )
    {
        for( int j = 0; j < I.cols(); j++ )
        {
            new_i = round( beta * (i + uv[0](i, j)) );
            new_j = round( beta * (j + uv[1](i, j)) );
            if(new_i > 0 && new_i < beta*n && new_j > 0 && new_j < beta*m)
            {
                moved_I(new_i, new_j) = I(i ,j);
                W(new_i, new_j) = 1;
            }

        }
    }

    return moved_I;
}
开发者ID:yanik-porto,项目名称:3DfromTOF,代码行数:29,代码来源:lidarboostengine.cpp


示例12: test_redux

void test_redux()
{
  // the max size cannot be too large, otherwise reduxion operations obviously generate large errors.
  int maxsize = (std::min)(100,EIGEN_TEST_MAX_SIZE);
  EIGEN_UNUSED_VARIABLE(maxsize);
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );
    CALL_SUBTEST_1( matrixRedux(Array<float, 1, 1>()) );
    CALL_SUBTEST_2( matrixRedux(Matrix2f()) );
    CALL_SUBTEST_2( matrixRedux(Array2f()) );
    CALL_SUBTEST_3( matrixRedux(Matrix4d()) );
    CALL_SUBTEST_3( matrixRedux(Array4d()) );
    CALL_SUBTEST_4( matrixRedux(MatrixXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_4( matrixRedux(ArrayXXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_5( matrixRedux(MatrixXd (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_5( matrixRedux(ArrayXXd (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_6( matrixRedux(MatrixXi (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_6( matrixRedux(ArrayXXi (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
  }
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_7( vectorRedux(Vector4f()) );
    CALL_SUBTEST_7( vectorRedux(Array4f()) );
    CALL_SUBTEST_5( vectorRedux(VectorXd(internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_5( vectorRedux(ArrayXd(internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_8( vectorRedux(VectorXf(internal::random<int>(1,maxsize))) );
    CALL_SUBTEST_8( vectorRedux(ArrayXf(internal::random<int>(1,maxsize))) );
  }
}
开发者ID:gorlak,项目名称:panda3d-thirdparty,代码行数:28,代码来源:redux.cpp


示例13: build_pose

// add_odom_xy_global_yprz_t: sets up the pose nodes and then calls the factor adding functions
bool FactorGraph::add_odom_xy_global_yprz(odom_xy_global_yprz_t odom){
  if (_poses[odom.id].size()==0){
    cout << "Rejecting odometry since no prior" << endl;
    return false;
  }
  Pose3dTS_Node* old_pose = _poses[odom.id].back();
  if (_poses[odom.id].back()->ts() != odom.t[0])
    cout << "Warning: Time mismatch for last pose time " << _poses[odom.id].back()->ts() << "and received" << odom.t[0] << endl;

  // for now just build a new pose and connect it to the last one for that id
  Pose3dTS_Node* pose =   build_pose(odom.t[1],odom.id);

  // manually initialize the new pose since all the factors are partial
  pos2_t pos2 = odom.odom_xy.pos2;
  rot3_t rot3 = odom.attitude;
  depth_t depth = odom.depth;
  Pose3d old  = (dynamic_cast<Pose3d_Node*>(old_pose))->value();
  Pose3d measure(pos2.mu[0], pos2.mu[1],0,0,0,0);
  Pose3d p2 = (MatrixXd(old.vector() + measure.vector()));
  Pose3d predict(p2.x(),p2.y(),depth.mu,rot3.mu[0],rot3.mu[1],rot3.mu[2]);
  pose->init(predict);

  // call private factor adding functions
  add_odom_xy(odom.odom_xy,old_pose,pose);
  add_global_ypr(odom.attitude,pose);
  add_global_z(odom.depth,pose);

  return true;

}
开发者ID:liampaull,项目名称:AUVCSLAM,代码行数:31,代码来源:FactorGraph.cpp


示例14: test_stdvector

void test_stdvector()
{
  // some non vectorizable fixed sizes
  CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));
  CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));
  CALL_SUBTEST_2(check_stdvector_matrix(Matrix3d()));

  // some vectorizable fixed sizes
  CALL_SUBTEST_1(check_stdvector_matrix(Matrix2f()));
  CALL_SUBTEST_1(check_stdvector_matrix(Vector4f()));
  CALL_SUBTEST_1(check_stdvector_matrix(Matrix4f()));
  CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));

  // some dynamic sizes
  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));
  CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));
  CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));
  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));

  // some Transform
  CALL_SUBTEST_4(check_stdvector_transform(Projective2f()));
  CALL_SUBTEST_4(check_stdvector_transform(Projective3f()));
  CALL_SUBTEST_4(check_stdvector_transform(Projective3d()));
  //CALL_SUBTEST(heck_stdvector_transform(Projective4d()));

  // some Quaternion
  CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));
  CALL_SUBTEST_5(check_stdvector_quaternion(Quaterniond()));
}
开发者ID:151706061,项目名称:ParaView,代码行数:29,代码来源:stdvector.cpp


示例15: MatrixXd

void lidarBoostEngine::set_selected_cloud(pcl::PointCloud<pcl::PointXYZI>::Ptr cloud, std::vector<int> numOfClouds)
{
    sz = cloud->size();
    n_cloud = sz/one_pcl_sz;
    std::cout << n_cloud << std::endl;

    int list_sz = numOfClouds.size();

    Y = std::vector< MatrixXd >( list_sz );
    std::vector< MatrixXd >eigMat( list_sz );

    int num = 0;
//    typedef std::vector< MatrixXd >::iterator it_type;
    for( int i = 0; i < list_sz; i++ )
    {
        eigMat[i] = MatrixXd( n, m );
        num = numOfClouds[i];

        for (int j = 0; j < one_pcl_sz; j++ )
        {
            eigMat[i]( j/m, j%m ) = cloud->points[ j+num*one_pcl_sz ].z;
        }
    }

    Y = eigMat;
}
开发者ID:yanik-porto,项目名称:3DfromTOF,代码行数:26,代码来源:lidarboostengine.cpp


示例16: test_eigensolver_generalized_real

void test_eigensolver_generalized_real()
{
    for(int i = 0; i < g_repeat; i++) {
        int s = 0;
        CALL_SUBTEST_1( generalized_eigensolver_real(Matrix4f()) );
        s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
        CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(s,s)) );

        // some trivial but implementation-wise tricky cases
        CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(1,1)) );
        CALL_SUBTEST_2( generalized_eigensolver_real(MatrixXd(2,2)) );
        CALL_SUBTEST_3( generalized_eigensolver_real(Matrix<double,1,1>()) );
        CALL_SUBTEST_4( generalized_eigensolver_real(Matrix2d()) );
        TEST_SET_BUT_UNUSED_VARIABLE(s)
    }
}
开发者ID:fangzhuang2004,项目名称:OpenPilot,代码行数:16,代码来源:eigensolver_generalized_real.cpp


示例17: test_swap

void test_swap()
{
  CALL_SUBTEST_1( swap(Matrix3f()) ); // fixed size, no vectorization
  CALL_SUBTEST_2( swap(Matrix4d()) ); // fixed size, possible vectorization
  CALL_SUBTEST_3( swap(MatrixXd(3,3)) ); // dyn size, no vectorization
  CALL_SUBTEST_4( swap(MatrixXf(30,30)) ); // dyn size, possible vectorization
}
开发者ID:151706061,项目名称:ParaView,代码行数:7,代码来源:swap.cpp


示例18: test_product_large

void test_product_large()
{
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
    CALL_SUBTEST( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
    CALL_SUBTEST( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
    CALL_SUBTEST( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
    CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
  }

  {
    // test a specific issue in DiagonalProduct
    int N = 1000000;
    VectorXf v = VectorXf::Ones(N);
    MatrixXf m = MatrixXf::Ones(N,3);
    m = (v+v).asDiagonal() * m;
    VERIFY_IS_APPROX(m, MatrixXf::Constant(N,3,2));
  }

  {
    // test deferred resizing in Matrix::operator=
    MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;
    VERIFY_IS_APPROX((a = a * b), (c * b).eval());
  }
}
开发者ID:kyleconroy,项目名称:starfighter,代码行数:25,代码来源:product_large.cpp


示例19: World

bool WorldSQP::iterative_control_opt(vector<vector<World*> >& trajectory, vector<vector<Control*> >& controls, int num_opts, bool return_best_opt, double threshold) 
{

  current_states.resize(trajectory.size());
  current_jacobians.resize(trajectory.size());

  for (int i = 0; i < trajectory.size(); i++) {
    current_states[i].resize(trajectory[i].size());
    current_jacobians[i].resize(trajectory[i].size());
    for (int j = 0; j < trajectory[i].size(); j++) { 
      current_states[i][j] = new World(*trajectory[i][j]);
      current_jacobians[i][j] = MatrixXd();
    }
  }
  
  assert(controls.size() == _num_worlds-1);
  current_controls = controls; 

  for (int opt_iter = 0; opt_iter < num_opts; opt_iter++) {
    solve();
  }
 
  
  
  trajectory = current_states;
  controls = current_controls;

  

  return true;
}
开发者ID:bo-wu,项目名称:surgical,代码行数:31,代码来源:worldSQP.cpp


示例20: Simulation

/**
 * Constructs the MetropolisHastingsSimulation object.
 *
 * @param pModel Pointer to the Model.
 * @param pData Pointer to the Data.
 */
MetropolisHastingsSimulation::MetropolisHastingsSimulation(Model* pModel,
		Data* pData) :
		Simulation(pModel, pData), //
		lScores(1, VectorXd(nStatistics())), //
		lScoreTargets(VectorXd::Zero(nStatistics())), //
		lNeedsDerivative(false), //
		lDerivative(1, MatrixXd(nParameters(), nParameters())), //
		lMeanScoresMinusTargets(), //
		lNRunMH(nPeriods()), //
		lResult(&lTheta, &lScoreTargets, 0/*ptr*/, &lScores, 0/*ptr*/,
				&lMeanScoresMinusTargets, 0/*ptr*/, 0/*ptr*/, &lDerivative, 0/*ptr*/)
	{
	// Conditional is not possible with maximum likelihood
	// R: sienaModelCreate.r sienaModelCreate() (line ~56)
	assert(!pModel->conditional());
	// Calculate the number of simulation steps per period.
	// R: initializeFran.r initializeFRAN() (line ~504)
	const MatrixXd targets = calculateTargetStatistics();
	const ArrayXb basicRates = rStatisticEffects().array()
			== &Simulation::RATE_EFFECT;
	const VectorXd zero = VectorXd::Zero(nStatistics());
	for (int m = 0; m < nPeriods(); ++m) {
		lNRunMH[m] = N_RUN_MH_MULTIPLICATOR_DEFAULT
				* basicRates.select(targets.row(m).transpose(), zero).sum();
		if (lNRunMH[m] > 100) {
			lNRunMH[m] = round((double) lNRunMH[m] / 100.0) * 100;
		}
	}
}
开发者ID:rforge,项目名称:rsiena,代码行数:35,代码来源:MetropolisHastingsSimulation.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MaybeStopParser函数代码示例发布时间:2022-05-30
下一篇:
C++ MatrixMultiply函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap