bug #352:properly cast constants

This commit is contained in:
Igor Krivenko
2011-12-09 23:38:41 +01:00
parent d400a6245e
commit 36457178f9
17 changed files with 40 additions and 40 deletions

View File

@@ -40,7 +40,7 @@ SparseMatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
eigen_assert(other.size()>0 && "you are using a non initialized vector");
typename Derived::InnerIterator i(derived(),0);
Scalar res = 0;
Scalar res(0);
while (i)
{
res += internal::conj(i.value()) * other.coeff(i.index());
@@ -64,7 +64,7 @@ SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) cons
typename Derived::InnerIterator i(derived(),0);
typename OtherDerived::InnerIterator j(other.derived(),0);
Scalar res = 0;
Scalar res(0);
while (i && j)
{
if (i.index()==j.index())

View File

@@ -30,7 +30,7 @@ typename internal::traits<Derived>::Scalar
SparseMatrixBase<Derived>::sum() const
{
eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
Scalar res = 0;
Scalar res(0);
for (Index j=0; j<outerSize(); ++j)
for (typename Derived::InnerIterator iter(derived(),j); iter; ++iter)
res += iter.value();

View File

@@ -48,7 +48,7 @@ struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Lower,RowMajor>
for(int i=0; i<lhs.rows(); ++i)
{
Scalar tmp = other.coeff(i,col);
Scalar lastVal = 0;
Scalar lastVal(0);
int lastIndex = 0;
for(typename Lhs::InnerIterator it(lhs, i); it; ++it)
{