mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-16 21:55:58 +08:00
Fix test for nearly null input
This commit is contained in:
parent
9ab35d8ba4
commit
263993a7b6
@ -42,9 +42,14 @@ void svd_check_full(const MatrixType& m, const SvdType& svd)
|
|||||||
MatrixUType u = svd.matrixU();
|
MatrixUType u = svd.matrixU();
|
||||||
MatrixVType v = svd.matrixV();
|
MatrixVType v = svd.matrixV();
|
||||||
RealScalar scaling = m.cwiseAbs().maxCoeff();
|
RealScalar scaling = m.cwiseAbs().maxCoeff();
|
||||||
if(scaling<=(std::numeric_limits<RealScalar>::min)())
|
if(scaling<(std::numeric_limits<RealScalar>::min)())
|
||||||
scaling = RealScalar(1);
|
{
|
||||||
VERIFY_IS_APPROX(m/scaling, u * (sigma/scaling) * v.adjoint());
|
VERIFY(sigma.cwiseAbs().maxCoeff() <= (std::numeric_limits<RealScalar>::min)());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VERIFY_IS_APPROX(m/scaling, u * (sigma/scaling) * v.adjoint());
|
||||||
|
}
|
||||||
VERIFY_IS_UNITARY(u);
|
VERIFY_IS_UNITARY(u);
|
||||||
VERIFY_IS_UNITARY(v);
|
VERIFY_IS_UNITARY(v);
|
||||||
}
|
}
|
||||||
@ -336,7 +341,7 @@ void svd_underoverflow()
|
|||||||
M << value_set(id(0)), value_set(id(1)), value_set(id(2)), value_set(id(3));
|
M << value_set(id(0)), value_set(id(1)), value_set(id(2)), value_set(id(3));
|
||||||
svd.compute(M,ComputeFullU|ComputeFullV);
|
svd.compute(M,ComputeFullU|ComputeFullV);
|
||||||
CALL_SUBTEST( svd_check_full(M,svd) );
|
CALL_SUBTEST( svd_check_full(M,svd) );
|
||||||
|
|
||||||
id(k)++;
|
id(k)++;
|
||||||
if(id(k)>=value_set.size())
|
if(id(k)>=value_set.size())
|
||||||
{
|
{
|
||||||
@ -344,7 +349,7 @@ void svd_underoverflow()
|
|||||||
id.head(k).setZero();
|
id.head(k).setZero();
|
||||||
k=0;
|
k=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while((id<int(value_set.size())).all());
|
} while((id<int(value_set.size())).all());
|
||||||
|
|
||||||
#if defined __INTEL_COMPILER
|
#if defined __INTEL_COMPILER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user