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


C++ Matrix::fullPivLu方法代码示例

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


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

示例1:

const Eigen::Vector4d CMiniVisionToolbox::getPointHomogeneousStereoLinearTriangulationLU( const Eigen::Vector2d& p_vecPointLeft, const Eigen::Vector2d& p_vecPointRight, const Eigen::Matrix< double, 3, 4 >& p_matProjectionLeft, const Eigen::Matrix< double, 3, 4 >& p_matProjectionRight )
{
    //ds A matrix for system: A*X=0
    Eigen::Matrix< double, 4 , 4 > matA;

    //ds fill the matrix
    matA.row(0) = p_vecPointLeft(0)*p_matProjectionLeft.row(2)-p_matProjectionLeft.row(0);
    matA.row(1) = p_vecPointLeft(1)*p_matProjectionLeft.row(2)-p_matProjectionLeft.row(1);
    matA.row(2) = p_vecPointRight(0)*p_matProjectionRight.row(2)-p_matProjectionRight.row(0);
    matA.row(3) = p_vecPointRight(1)*p_matProjectionRight.row(2)-p_matProjectionRight.row(1);

    //ds homogeneous solution
    return matA.fullPivLu( ).kernel( );
}
开发者ID:schdomin,项目名称:vi_mapper,代码行数:14,代码来源:CMiniVisionToolbox.cpp

示例2: H

bool ErrorStateKF<Scalar>::update(const ErrorStateKF<Scalar>::quat &qm,
                                  const ErrorStateKF<Scalar>::mat3 &varQ,
                                  const ErrorStateKF<Scalar>::vec3 &pm,
                                  const ErrorStateKF<Scalar>::mat3 &varP,
                                  const ErrorStateKF<Scalar>::vec3 &vm,
                                  const ErrorStateKF<Scalar>::mat3 &varV) {
  //  form the measurement jacobian
  Eigen::Matrix<Scalar, 7, 15> H;
  H.setZero();

  //  position and velocity
  H.template block<3, 3>(0, 12).setIdentity();
  H.template block<3, 3>(3, 6).setIdentity();

  //  orientation
  // H.template block<3, 3>(6, 0).setIdentity();
  H(6, 2) = 1;

  // residual
  Eigen::Matrix<Scalar,7,1> r;

  //  non-linear rotation residual on yaw axis
  const quat dq = q_.conjugate() * qm;
  const Eigen::AngleAxis<Scalar> aa(dq);
  const vec3 rpy = kr::rotToEulerZYX(aa.matrix());

  // r.template block<3, 1>(6, 0) = aa.angle()*aa.axis();
  r(6, 0) = rpy[2];

  //  linear pos/velocity
  r.template block<3, 1>(0, 0) = pm - p_;
  r.template block<3, 1>(3, 0) = vm - v_;

  //  measurement covariance
  Eigen::Matrix<Scalar,7,7> R;
  R.setZero();
  R.template block<3, 3>(0, 0) = varP;
  R.template block<3, 3>(3, 3) = varV;
  // R.template block<3, 3>(6, 6) = varQ;
  R(6, 6) = varQ(2, 2);

  //  kalman update
  Eigen::Matrix<Scalar,7,7> S = H * P_ * H.transpose() + R;
  auto LU = S.fullPivLu();
  if (!LU.isInvertible()) {
    return false;
  }
  S = LU.inverse();

  const Eigen::Matrix<Scalar,15,7> K = P_ * H.transpose() * S;
  const Eigen::Matrix<Scalar,15,1> dx = K * r;

  P_ = (Eigen::Matrix<Scalar, 15, 15>::Identity() - K * H) * P_;

  //  update state
  q_ *= quat(1, dx[0] * 0.5, dx[1] * 0.5, dx[2] * 0.5);
  q_.normalize();
  bg_.noalias() += dx.template block<3, 1>(3, 0);
  v_.noalias() += dx.template block<3, 1>(6, 0);
  ba_.noalias() += dx.template block<3, 1>(9, 0);
  p_.noalias() += dx.template block<3, 1>(12, 0);

  return true;
}
开发者ID:libing64,项目名称:gps-tools,代码行数:64,代码来源:error_state_kf.hpp


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