|Re: [eigen] Overflow in sum()|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
I see. So I go for my own safe_sum(). Probably this is a uncommon use
Benoit Jacob wrote:
> It depends how common your use case is: if many people are going to do
> the same, we could have another template parameter for sparse
> matrices, the "accumulated scalar type", decoupled from the "scalar
> Otherwise, you might just have your own safe_sum() method (we can add
> EIGEN_SPARSEMATRIX_PLUGIN and/or EIGEN_SPARSEMATRIXBASE_PLUGIN macros
> if you need, so you can add methods also to sparse classes).
> 2009/4/1 Jens Mueller <jens.k.mueller@xxxxxx>:
> > Hi,
> > I added a custom Scalar type to Eigen, because my sparse matrices have
> > many coefficients but these are rather small integers. When using the
> > sum() method, I get wrong results, because the function returns a
> > Scalar. I added an assertion (see attached diff against current trunk)
> > to check for possible overflows.
> > I'm willing to fix this problem but I'm not sure how. Any
> > recommendations how to proceed?
> > Regards,
> > Jens