mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Big renaming:
start ---> head end ---> tail Much frustration with sed syntax. Need to learn perl some day.
This commit is contained in:
@@ -67,7 +67,7 @@ template<typename Scalar,int Size> void homogeneous(void)
|
||||
VERIFY_IS_APPROX(m0, hm0.colwise().hnormalized());
|
||||
hm0.row(Size-1).setRandom();
|
||||
for(int j=0; j<Size; ++j)
|
||||
m0.col(j) = hm0.col(j).start(Size) / hm0(Size,j);
|
||||
m0.col(j) = hm0.col(j).head(Size) / hm0(Size,j);
|
||||
VERIFY_IS_APPROX(m0, hm0.colwise().hnormalized());
|
||||
|
||||
T1MatrixType t1 = T1MatrixType::Random();
|
||||
|
||||
@@ -66,7 +66,7 @@ template<typename Scalar> void orthomethods_3()
|
||||
v41 = Vector4::Random(),
|
||||
v42 = Vector4::Random();
|
||||
v40.w() = v41.w() = v42.w() = 0;
|
||||
v42.template start<3>() = v40.template start<3>().cross(v41.template start<3>());
|
||||
v42.template head<3>() = v40.template head<3>().cross(v41.template head<3>());
|
||||
VERIFY_IS_APPROX(v40.cross3(v41), v42);
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ template<typename Scalar, int Size> void orthomethods(int size=Size)
|
||||
|
||||
if (size>=3)
|
||||
{
|
||||
v0.template start<2>().setZero();
|
||||
v0.end(size-2).setRandom();
|
||||
v0.template head<2>().setZero();
|
||||
v0.tail(size-2).setRandom();
|
||||
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(v0.unitOrthogonal().dot(v0), Scalar(1));
|
||||
VERIFY_IS_APPROX(v0.unitOrthogonal().norm(), RealScalar(1));
|
||||
|
||||
@@ -118,7 +118,7 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
t0.scale(v0);
|
||||
t1.prescale(v0);
|
||||
|
||||
VERIFY_IS_APPROX( (t0 * Vector3(1,0,0)).template start<3>().norm(), v0.x());
|
||||
VERIFY_IS_APPROX( (t0 * Vector3(1,0,0)).template head<3>().norm(), v0.x());
|
||||
//VERIFY(!ei_isApprox((t1 * Vector3(1,0,0)).norm(), v0.x()));
|
||||
|
||||
t0.setIdentity();
|
||||
@@ -290,12 +290,12 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
// translation * vector
|
||||
t0.setIdentity();
|
||||
t0.translate(v0);
|
||||
VERIFY_IS_APPROX((t0 * v1).template start<3>(), Translation3(v0) * v1);
|
||||
VERIFY_IS_APPROX((t0 * v1).template head<3>(), Translation3(v0) * v1);
|
||||
|
||||
// AlignedScaling * vector
|
||||
t0.setIdentity();
|
||||
t0.scale(v0);
|
||||
VERIFY_IS_APPROX((t0 * v1).template start<3>(), AlignedScaling3(v0) * v1);
|
||||
VERIFY_IS_APPROX((t0 * v1).template head<3>(), AlignedScaling3(v0) * v1);
|
||||
|
||||
// test transform inversion
|
||||
t0.setIdentity();
|
||||
|
||||
@@ -53,7 +53,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
||||
v1.makeHouseholder(essential, beta, alpha);
|
||||
v1.applyHouseholderOnTheLeft(essential,beta,tmp);
|
||||
VERIFY_IS_APPROX(v1.norm(), v2.norm());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(v1.end(rows-1).norm(), v1.norm());
|
||||
VERIFY_IS_MUCH_SMALLER_THAN(v1.tail(rows-1).norm(), v1.norm());
|
||||
v1 = VectorType::Random(rows);
|
||||
v2 = v1;
|
||||
v1.applyHouseholderOnTheLeft(essential,beta,tmp);
|
||||
@@ -63,7 +63,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
||||
m2(rows, cols);
|
||||
|
||||
v1 = VectorType::Random(rows);
|
||||
if(even) v1.end(rows-1).setZero();
|
||||
if(even) v1.tail(rows-1).setZero();
|
||||
m1.colwise() = v1;
|
||||
m2 = m1;
|
||||
m1.col(0).makeHouseholder(essential, beta, alpha);
|
||||
@@ -74,7 +74,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
||||
VERIFY_IS_APPROX(ei_real(m1(0,0)), alpha);
|
||||
|
||||
v1 = VectorType::Random(rows);
|
||||
if(even) v1.end(rows-1).setZero();
|
||||
if(even) v1.tail(rows-1).setZero();
|
||||
SquareMatrixType m3(rows,rows), m4(rows,rows);
|
||||
m3.rowwise() = v1.transpose();
|
||||
m4 = m3;
|
||||
|
||||
@@ -68,9 +68,9 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
|
||||
if (rows>1)
|
||||
{
|
||||
m2 = m1.template triangularView<LowerTriangular>();
|
||||
m2.block(1,1,rows-1,cols-1).template selfadjointView<LowerTriangular>().rankUpdate(v1.end(rows-1),v2.start(cols-1));
|
||||
m2.block(1,1,rows-1,cols-1).template selfadjointView<LowerTriangular>().rankUpdate(v1.tail(rows-1),v2.head(cols-1));
|
||||
m3 = m1;
|
||||
m3.block(1,1,rows-1,cols-1) += v1.end(rows-1) * v2.start(cols-1).adjoint()+ v2.start(cols-1) * v1.end(rows-1).adjoint();
|
||||
m3.block(1,1,rows-1,cols-1) += v1.tail(rows-1) * v2.head(cols-1).adjoint()+ v2.head(cols-1) * v1.tail(rows-1).adjoint();
|
||||
VERIFY_IS_APPROX(m2, m3.template triangularView<LowerTriangular>().toDenseMatrix());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||
minc = std::min(minc, ei_real(v[j]));
|
||||
maxc = std::max(maxc, ei_real(v[j]));
|
||||
}
|
||||
VERIFY_IS_APPROX(s, v.start(i).sum());
|
||||
VERIFY_IS_APPROX(p, v.start(i).prod());
|
||||
VERIFY_IS_APPROX(minc, v.real().start(i).minCoeff());
|
||||
VERIFY_IS_APPROX(maxc, v.real().start(i).maxCoeff());
|
||||
VERIFY_IS_APPROX(s, v.head(i).sum());
|
||||
VERIFY_IS_APPROX(p, v.head(i).prod());
|
||||
VERIFY_IS_APPROX(minc, v.real().head(i).minCoeff());
|
||||
VERIFY_IS_APPROX(maxc, v.real().head(i).maxCoeff());
|
||||
}
|
||||
|
||||
for(int i = 0; i < size-1; i++)
|
||||
@@ -85,10 +85,10 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||
minc = std::min(minc, ei_real(v[j]));
|
||||
maxc = std::max(maxc, ei_real(v[j]));
|
||||
}
|
||||
VERIFY_IS_APPROX(s, v.end(size-i).sum());
|
||||
VERIFY_IS_APPROX(p, v.end(size-i).prod());
|
||||
VERIFY_IS_APPROX(minc, v.real().end(size-i).minCoeff());
|
||||
VERIFY_IS_APPROX(maxc, v.real().end(size-i).maxCoeff());
|
||||
VERIFY_IS_APPROX(s, v.tail(size-i).sum());
|
||||
VERIFY_IS_APPROX(p, v.tail(size-i).prod());
|
||||
VERIFY_IS_APPROX(minc, v.real().tail(size-i).minCoeff());
|
||||
VERIFY_IS_APPROX(maxc, v.real().tail(size-i).maxCoeff());
|
||||
}
|
||||
|
||||
for(int i = 0; i < size/2; i++)
|
||||
|
||||
@@ -51,7 +51,7 @@ void makeNoisyCohyperplanarPoints(int numPoints,
|
||||
{
|
||||
cur_point = VectorType::Random(size)/*.normalized()*/;
|
||||
// project cur_point onto the hyperplane
|
||||
Scalar x = - (hyperplane->coeffs().start(size).cwise()*cur_point).sum();
|
||||
Scalar x = - (hyperplane->coeffs().head(size).cwise()*cur_point).sum();
|
||||
cur_point *= hyperplane->coeffs().coeff(size) / x;
|
||||
} while( cur_point.norm() < 0.5
|
||||
|| cur_point.norm() > 2.0 );
|
||||
|
||||
@@ -127,15 +127,15 @@ template<typename MatrixType> void submatrices(const MatrixType& m)
|
||||
if (rows>2)
|
||||
{
|
||||
// test sub vectors
|
||||
VERIFY_IS_APPROX(v1.template start<2>(), v1.block(0,0,2,1));
|
||||
VERIFY_IS_APPROX(v1.template start<2>(), v1.start(2));
|
||||
VERIFY_IS_APPROX(v1.template start<2>(), v1.segment(0,2));
|
||||
VERIFY_IS_APPROX(v1.template start<2>(), v1.template segment<2>(0));
|
||||
VERIFY_IS_APPROX(v1.template head<2>(), v1.block(0,0,2,1));
|
||||
VERIFY_IS_APPROX(v1.template head<2>(), v1.head(2));
|
||||
VERIFY_IS_APPROX(v1.template head<2>(), v1.segment(0,2));
|
||||
VERIFY_IS_APPROX(v1.template head<2>(), v1.template segment<2>(0));
|
||||
int i = rows-2;
|
||||
VERIFY_IS_APPROX(v1.template end<2>(), v1.block(i,0,2,1));
|
||||
VERIFY_IS_APPROX(v1.template end<2>(), v1.end(2));
|
||||
VERIFY_IS_APPROX(v1.template end<2>(), v1.segment(i,2));
|
||||
VERIFY_IS_APPROX(v1.template end<2>(), v1.template segment<2>(i));
|
||||
VERIFY_IS_APPROX(v1.template tail<2>(), v1.block(i,0,2,1));
|
||||
VERIFY_IS_APPROX(v1.template tail<2>(), v1.tail(2));
|
||||
VERIFY_IS_APPROX(v1.template tail<2>(), v1.segment(i,2));
|
||||
VERIFY_IS_APPROX(v1.template tail<2>(), v1.template segment<2>(i));
|
||||
i = ei_random(0,rows-2);
|
||||
VERIFY_IS_APPROX(v1.segment(i,2), v1.template segment<2>(i));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user