Re: [eigen] bug in data() on col/row |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] bug in data() on col/row
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sun, 30 Aug 2009 11:35:28 -0400
- 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; bh=S8PhhfSiuL3PMhO6XsuYpNKvOJv7Ao1pttSU2Hz3L28=; b=jhnFFvzw+YdKGPDdDsFGOstgSfe1ySlBM4hBZJiC2zfcuWfmcoeIgo7vNLWneSODJy W2IYB3lAlE9lioTGF8a17iAxaE/ILzN6otg2VAD4QsaN9qDIipCXX54DFapkVUidYDxB XpzaOuTJW7pr1+9LSbjGgKZ2dmNjvokVww6cA=
- 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; b=eI7Fgo4tA8NY5fglFL8oEoGxI8uAQdmOZuq/Bd3LGyRu71zt3w8kwgZ4lv0FtexgNH dt6hqGduEClNDByjSj0dIMDw2DRJ81OYAo2xPLYQhw7EZiUlTvG/NhVnghOSOcnOyOk2 1z4G4dH8zDDtL8+RKtUqnrXtN/tHksdam8c/0=
2009/8/30 Benjamin Schindler <bschindler@xxxxxxxxxxx>:
> Hi
>
> Well, I know that this was my expectation - and I'm fully aware that this
> code is kinda bogus. But on the other hand, writing
>
> somematrix.row(2).data() does give the expectation that you get that row
> data (as this is what the code is trying to tell me).
> That's why I wrote that mail - I think that code is unsafe and can lead to
> "unexpected" behaviour and if there is something Eigen can do about this, it
> should be done
Ah, OK, I understand your point. Sorry I didn't get it the first time.
But what can Eigen do, when it sees data() being called on a
non-memory-contiguous block, such as a row in a column-major matrix?
Should it just forbid that (with an assertion) ?
That's open for discussion. There is an argument against, though:
there's a use case for using data() to retrieve the address of the
first coefficient in the row, and then iterate by incrementing this
pointer by the size of a column, to traverse the row.
Benoit