Re: [eigen] Index bounds checking assertion |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Index bounds checking assertion
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 9 Jun 2010 07:14:13 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ueJFyemAaNUI2no1NYue1BzyU5zV7ZuLEYvU3hL/t2Q=; b=FcQF3+7dEghWXi6mNtUyN0+TG8uJ5YjuR5fZCO+Ayjd0wOcXVfVaqKrglEvCqueBKf CElerDF2KFq3oP4Q4QNzoWB0Loifk/kgpX0kwUPaTJXaqdSGWUu6hv0cLWmdA17IP7zZ U40UgmRZCCs1M8U2UFnnu6LueVLYUNd3Gv9CA=
- 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=qybk/eO8xKjgc9+j0e3yjjeo7jBfBv62Gq0NCfrikua9OWV6OVNX3awb7np6Pz745M DKeVjC5wVQGRRbAwiE97dO5UCPqKW3rpmDrIw0nZ6vJUdykHnQf9USgOOR+X9euhJRv7 FlZH4NYOG/a7dD6QNvuRMVaIT6Sd9knwnPX6o=
I don't know... by entering a debugger, the user can print row and col
and rows() and cols() and figure it out right away; no need for printf
debugging here.
Splitting this into more assertions will have the (small) drawback of
inflating a bit more the code size, since each assertion will have its
own string, and these are rather long strings. Suppose each string is
150 bytes, this would go from 1 to 4 strings, so 450 more bytes. The
problem is that this is for each separate expression type, and a
typical can have many of those, e.g. 100 types, leading to a 45 kB
code size increase. Of course this goes away when you disable asserts,
but currently leaving asserts often has a negligible speed cost, which
allows many users to leave them in even in release code.
Benoit
2010/6/9 Rohit Garg <rpg.314@xxxxxxxxx>:
> Presently, in the DenseCoeffsBase.h, file, line 305, we have the
> runtime assertion, row >= 0 && row < rows() && col >= 0 && col <
> cols()
>
> It will be better to split it into 4 assertions so that when the
> assertion fails, we get a more pointed message. Otherwise, the user
> needs to do some debugging, (printf or otherwise), just to figure out
> which index malfunctioned and from what side.
>
> --
> Rohit Garg
>
> http://rpg-314.blogspot.com/
>
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology
> Bombay
>
>
>