本文整理汇总了C++中TMatrix::transpose方法的典型用法代码示例。如果您正苦于以下问题:C++ TMatrix::transpose方法的具体用法?C++ TMatrix::transpose怎么用?C++ TMatrix::transpose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMatrix
的用法示例。
在下文中一共展示了TMatrix::transpose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: C
void CPDRigid<T, D>::m_step()
{
T N_P = _P1.sum();
TVector mu_x = _data.transpose() * _PT1 / N_P;
TVector mu_y = _model.transpose() * _P1 / N_P;
TMatrixD X_hat = _data - TMatrix(TVector(_N).setOnes() * mu_x.transpose());
TMatrixD Y_hat = _model - TMatrix(TVector(_M).setOnes() * mu_y.transpose());
TMatrix A = (_PX-_P1*mu_x.transpose()).transpose() *
(_model - TMatrix(TVector(_M).setOnes() * mu_y.transpose()));
Eigen::JacobiSVD<TMatrix> svd(A, Eigen::ComputeThinU | Eigen::ComputeThinV);
TMatrix U = svd.matrixU();
TMatrix V = svd.matrixV();
T det_uv = TMatrix(U*V.transpose()).determinant();
TVector C(D);
C.setIdentity();
C(D-1) = det_uv;
_paras._R = U * C.asDiagonal() * V.transpose();
T s_upper = TMatrix(A.transpose()*_paras._R).trace();
T s_lower = TMatrix(Y_hat.transpose()*_P1.asDiagonal()*Y_hat).trace();
_paras._s = s_upper / s_lower;
_paras._t = mu_x - _paras._s * _paras._R * mu_y;
T tr_f = TMatrix(X_hat.transpose()*_PT1.asDiagonal()*X_hat).trace();
T tr_b = TMatrix(A.transpose()*_paras._R).trace();
_paras._sigma2 = (tr_f - _paras._s * tr_b) / (N_P * D);
}
示例2: minRectTest
void minRectTest(std::string name, const TMatrix & v) {
using namespace PointFunctions;
using namespace TestFunctions;
dumpPointsMatrixBinary( getPointsDumpPath(name,".bin") ,v);
dumpPointsMatrix( getPointsDumpPath(name,".txt"),v);
std::cout << "\n\nStart MinAreaRectangle Test "+ name +"" << std::endl;
START_TIMER(start)
MinAreaRectangle c(v);
c.compute();
STOP_TIMER_SEC(count, start)
std::cout << "Timings: " << count << " sec for " <<v.cols() << " points" << std::endl;
std::cout << "End MinAreaRectangle Test "+ name +"" << std::endl;
auto rect = c.getMinRectangle();
Matrix2Dyn p(2,6);
p.col(0) = rect.m_p;
p.col(1) = rect.m_p + rect.m_u*rect.m_uL ;
p.col(2) = rect.m_p + rect.m_u*rect.m_uL + rect.m_v*rect.m_vL ;
p.col(3) = rect.m_p + rect.m_v*rect.m_vL ;
p.col(4) = rect.m_u;
p.col(5) = rect.m_v;
dumpPointsMatrixBinary(getFileOutPath(name) ,p);
//dumpPointsMatrix(getFileOutPath(name,".txt"),p);
// Compare with validation file
TMatrix valid = p;
valid.setConstant(std::numeric_limits<PREC>::signaling_NaN());
readPointsMatrixBinary( getFileValidationPath(name) , valid);
// Assert all cols of p are in valid
EXPECT_TRUE( assertNearArrayColsRows<true>(p.leftCols(4),valid.leftCols(4)) ) << "Valid Points:" << std::endl << valid.transpose()
<< std::endl << " computed:" << std::endl << p.transpose() << std::endl;
}