|Re: [eigen] Overflow in sum()|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Overflow in sum()
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 1 Apr 2009 16:24:37 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=4To6JSCwkQn4GMI2e27jJ1XJSv6a1ONndHm2O2qpqG8=; b=FgsrfkrGKVP84DibOEB1eEomeypKCd7nxL5pPPiRAogJIrImI7Dowb4UARLLMQK57G MoMs0hCl18xmPTIZHZ6ZBSm5pROziFUIYosJ+Hcqgc+ae01CABFm9THITjY7C85Z1rg0 AtKGm0KOL3li+gZ+M8pAXpnHiZrkZlOfBvp/Q=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Dd945SIrGEcxkG0UNBa0P1FRe4VAKpOrfXbwO6LbA3RcYFJGS8cOFvENr15NmJOX0F eKnuBJQrlH2ZAWo6zLjUQJkelVZnelsDSPrT/K0nrm2mhUb8BeIJe6Lcvl+n0+a+J+7b JinhjoqjJ4IALgWY2iQm3uAok8gPl6+TdUrIo=
About your patch: we don't do asserts for overflows, innacuracies,
etc. Asserts crash programs, so they should only guard against plain
coding errors that can cause dangerous problems (typically: bad memory
accesses). Asserts are also costly (runtime check) and often are left
enabled in linux distro packages, so here it's not optimal to have an
assert in an inner loop.
2009/4/1 Jens Mueller <jens.k.mueller@xxxxxx>:
> 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?