mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix bug #581: remove useless piece of code is blueNorm
(transplanted from 8f44205671
)
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template<typename ExpressionType, typename Scalar>
|
template<typename ExpressionType, typename Scalar>
|
||||||
inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
|
inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
|
||||||
{
|
{
|
||||||
@@ -76,21 +77,20 @@ MatrixBase<Derived>::blueNorm() const
|
|||||||
using std::pow;
|
using std::pow;
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
static Index nmax = -1;
|
static bool initialized = false;
|
||||||
static RealScalar b1, b2, s1m, s2m, overfl, rbig, relerr;
|
static RealScalar b1, b2, s1m, s2m, overfl, rbig, relerr;
|
||||||
if(nmax <= 0)
|
if(!initialized)
|
||||||
{
|
{
|
||||||
int nbig, ibeta, it, iemin, iemax, iexp;
|
int ibeta, it, iemin, iemax, iexp;
|
||||||
RealScalar abig, eps;
|
RealScalar abig, eps;
|
||||||
// This program calculates the machine-dependent constants
|
// This program calculates the machine-dependent constants
|
||||||
// bl, b2, slm, s2m, relerr overfl, nmax
|
// bl, b2, slm, s2m, relerr overfl
|
||||||
// from the "basic" machine-dependent numbers
|
// from the "basic" machine-dependent numbers
|
||||||
// nbig, ibeta, it, iemin, iemax, rbig.
|
// ibeta, it, iemin, iemax, rbig.
|
||||||
// The following define the basic machine-dependent constants.
|
// The following define the basic machine-dependent constants.
|
||||||
// For portability, the PORT subprograms "ilmaeh" and "rlmach"
|
// For portability, the PORT subprograms "ilmaeh" and "rlmach"
|
||||||
// are used. For any specific computer, each of the assignment
|
// are used. For any specific computer, each of the assignment
|
||||||
// statements can be replaced
|
// statements can be replaced
|
||||||
nbig = (std::numeric_limits<Index>::max)(); // largest integer
|
|
||||||
ibeta = std::numeric_limits<RealScalar>::radix; // base for floating-point numbers
|
ibeta = std::numeric_limits<RealScalar>::radix; // base for floating-point numbers
|
||||||
it = std::numeric_limits<RealScalar>::digits; // number of base-beta digits in mantissa
|
it = std::numeric_limits<RealScalar>::digits; // number of base-beta digits in mantissa
|
||||||
iemin = std::numeric_limits<RealScalar>::min_exponent; // minimum exponent
|
iemin = std::numeric_limits<RealScalar>::min_exponent; // minimum exponent
|
||||||
@@ -111,8 +111,7 @@ MatrixBase<Derived>::blueNorm() const
|
|||||||
eps = RealScalar(pow(double(ibeta), 1-it));
|
eps = RealScalar(pow(double(ibeta), 1-it));
|
||||||
relerr = internal::sqrt(eps); // tolerance for neglecting asml
|
relerr = internal::sqrt(eps); // tolerance for neglecting asml
|
||||||
abig = RealScalar(1.0/eps - 1.0);
|
abig = RealScalar(1.0/eps - 1.0);
|
||||||
if (RealScalar(nbig)>abig) nmax = int(abig); // largest safe n
|
initialized = true;
|
||||||
else nmax = nbig;
|
|
||||||
}
|
}
|
||||||
Index n = size();
|
Index n = size();
|
||||||
RealScalar ab2 = b2 / RealScalar(n);
|
RealScalar ab2 = b2 / RealScalar(n);
|
||||||
|
|||||||
Reference in New Issue
Block a user