mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #352:properly cast constants
This commit is contained in:
@@ -432,7 +432,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
|
||||
const Scalar eps = NumTraits<Scalar>::epsilon();
|
||||
|
||||
// inefficient! this is already computed in RealSchur
|
||||
Scalar norm = 0.0;
|
||||
Scalar norm(0);
|
||||
for (Index j = 0; j < size; ++j)
|
||||
{
|
||||
norm += m_matT.row(j).segment((std::max)(j-1,Index(0)), size-(std::max)(j-1,Index(0))).cwiseAbs().sum();
|
||||
@@ -452,7 +452,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
|
||||
// Scalar vector
|
||||
if (q == Scalar(0))
|
||||
{
|
||||
Scalar lastr=0, lastw=0;
|
||||
Scalar lastr(0), lastw(0);
|
||||
Index l = n;
|
||||
|
||||
m_matT.coeffRef(n,n) = 1.0;
|
||||
@@ -498,7 +498,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
|
||||
}
|
||||
else if (q < Scalar(0) && n > 0) // Complex vector
|
||||
{
|
||||
Scalar lastra=0, lastsa=0, lastw=0;
|
||||
Scalar lastra(0), lastsa(0), lastw(0);
|
||||
Index l = n-1;
|
||||
|
||||
// Last vector component imaginary so matrix is triangular
|
||||
|
||||
@@ -235,7 +235,7 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::compute(const MatrixType& matrix,
|
||||
// Rows iu+1,...,end are already brought in triangular form.
|
||||
Index iu = m_matT.cols() - 1;
|
||||
Index iter = 0; // iteration count
|
||||
Scalar exshift = 0.0; // sum of exceptional shifts
|
||||
Scalar exshift(0); // sum of exceptional shifts
|
||||
Scalar norm = computeNormOfT();
|
||||
|
||||
while (iu >= 0)
|
||||
@@ -288,7 +288,7 @@ inline typename MatrixType::Scalar RealSchur<MatrixType>::computeNormOfT()
|
||||
// FIXME to be efficient the following would requires a triangular reduxion code
|
||||
// Scalar norm = m_matT.upper().cwiseAbs().sum()
|
||||
// + m_matT.bottomLeftCorner(size-1,size-1).diagonal().cwiseAbs().sum();
|
||||
Scalar norm = 0.0;
|
||||
Scalar norm(0);
|
||||
for (Index j = 0; j < size; ++j)
|
||||
norm += m_matT.row(j).segment((std::max)(j-1,Index(0)), size-(std::max)(j-1,Index(0))).cwiseAbs().sum();
|
||||
return norm;
|
||||
|
||||
@@ -427,7 +427,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
||||
|
||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||
RealScalar scale = matrix.cwiseAbs().maxCoeff();
|
||||
if(scale==Scalar(0)) scale = 1;
|
||||
if(scale==Scalar(0)) scale = Scalar(1);
|
||||
mat = matrix / scale;
|
||||
m_subdiag.resize(n-1);
|
||||
internal::tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
|
||||
@@ -513,7 +513,7 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
|
||||
using std::atan2;
|
||||
using std::cos;
|
||||
using std::sin;
|
||||
const Scalar s_inv3 = 1.0/3.0;
|
||||
const Scalar s_inv3 = Scalar(1.0)/Scalar(3.0);
|
||||
const Scalar s_sqrt3 = sqrt(Scalar(3.0));
|
||||
|
||||
// The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The
|
||||
|
||||
Reference in New Issue
Block a user