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:
@@ -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())
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user