mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-13 00:21:49 +08:00
fix stable_norm unit test
This commit is contained in:
parent
0b426ea00d
commit
3b5a9acba8
@ -55,12 +55,12 @@ void MatrixBase<Derived>::makeHouseholderInPlace(Scalar *tau, RealScalar *beta)
|
|||||||
* \f$ H = I - tau v v^*\f$
|
* \f$ H = I - tau v v^*\f$
|
||||||
* and the vector v is:
|
* and the vector v is:
|
||||||
* \f$ v^T = [1 essential^T] \f$
|
* \f$ v^T = [1 essential^T] \f$
|
||||||
*
|
*
|
||||||
* On output:
|
* On output:
|
||||||
* \param essential the essential part of the vector \c v
|
* \param essential the essential part of the vector \c v
|
||||||
* \param tau the scaling factor of the householder transformation
|
* \param tau the scaling factor of the householder transformation
|
||||||
* \param beta the result of H * \c *this
|
* \param beta the result of H * \c *this
|
||||||
*
|
*
|
||||||
* \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(),
|
* \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(),
|
||||||
* MatrixBase::applyHouseholderOnTheRight()
|
* MatrixBase::applyHouseholderOnTheRight()
|
||||||
*/
|
*/
|
||||||
@ -73,10 +73,10 @@ void MatrixBase<Derived>::makeHouseholder(
|
|||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
|
||||||
VectorBlock<Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size()-1);
|
VectorBlock<Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size()-1);
|
||||||
|
|
||||||
RealScalar tailSqNorm = size()==1 ? 0 : tail.squaredNorm();
|
RealScalar tailSqNorm = size()==1 ? 0 : tail.squaredNorm();
|
||||||
Scalar c0 = coeff(0);
|
Scalar c0 = coeff(0);
|
||||||
|
|
||||||
if(tailSqNorm == RealScalar(0) && ei_imag(c0)==RealScalar(0))
|
if(tailSqNorm == RealScalar(0) && ei_imag(c0)==RealScalar(0))
|
||||||
{
|
{
|
||||||
*tau = 0;
|
*tau = 0;
|
||||||
|
@ -36,7 +36,7 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
|
|||||||
int rows = m.rows();
|
int rows = m.rows();
|
||||||
int cols = m.cols();
|
int cols = m.cols();
|
||||||
|
|
||||||
Scalar big = ei_random<Scalar>() * std::numeric_limits<RealScalar>::max() * RealScalar(1e-4);
|
Scalar big = ei_abs(ei_random<Scalar>()) * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4));
|
||||||
Scalar small = static_cast<RealScalar>(1)/big;
|
Scalar small = static_cast<RealScalar>(1)/big;
|
||||||
|
|
||||||
MatrixType vzero = MatrixType::Zero(rows, cols),
|
MatrixType vzero = MatrixType::Zero(rows, cols),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user