Re: [eigen] Submatrix of a matrix does not preserve majorness |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Submatrix of a matrix does not preserve majorness*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Sat, 2 Feb 2019 22:09:29 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=hmUrkor5TjKK94DZdn5w4wVwz6BAsVy/K/mX0XBRP0o=; b=tJUdqyH+DS61jPfLehhCW1YnEm/VfBdv4QbWsEnzAf+yfxJIg6Y5H/s65sm+CMD08u PpvGxaeI8Hfb44hYVopjgyZya8BdTGepmkLF8c4TPCcSKf+oPkoYkGkdjhz553YcX8Xs so33CR3iaF8vtvJ5mlXjO9oNabIDIALbZk0cLKJouRmPKZTxAqzmouyLJnqYpGv1a1cX zurSqoLJKuFzaWMPrIEcrGOmrCL0HxTAnJRRgOJGZX621+C6hLDV93xNdRg2Z7aeDCq4 0fdJEy3iTErvXNPFe0KV5jQN9tIn4CgV11NqCPQqtIBxvsmEIm+8rcUndPbJmvLpgyGe 6VVQ==

See bug 416 for discussions on that matter: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=416

For the record, I've recently been tricked by this issue too: https://bitbucket.org/eigen/eigen/src/fd83cfbceb90e303a935c86238f1e3cf3bd913ef/Eigen/src/Core/PartialReduxEvaluator.h#lines-209 , so I agree this behavior should be changed, but as discussed in bug 416 that's not as straightforward as it looks at first glance.

Gaël.

On Sat, Feb 2, 2019 at 4:08 AM Yuanchen Zhu <yuanchen.zhu@xxxxxxxxx> wrote:

Hi,I find it unintuitive that a submatrix of a matrix can change its majorness depending on if the submatrix is a row or a column. Say M is a column-majored matrix. Then M.row(i) is actually conceptually row-majored. This becomes an issue once you start to reshape the resulting 1D quantity, e.g, you might want treat pixels in a 2D image as a row of a big 3-row matrix. Then at the end, you want to unpack a row back into a 2d matrix. Natuarally, when you do unshape, you should preserve the majorness. But the row is actually row-majored, so if you don't change the majorness when you reshape, you get a row-majored matrix at the end.To summarize: Having submatrix operations changing the majorness of the resulting submatrix depending on its shape is a library-wart. Can we change this behavior? Essentially once you choose a majorness convention for your application, all matrix operations should not change the majorness of the resulting matrix, unless EXPLICITLY requested by user, e.g., for efficiency.Thanks,Yuanchen

**Follow-Ups**:**Re: [eigen] Submatrix of a matrix does not preserve majorness***From:*Yuanchen Zhu

**References**:**[eigen] Submatrix of a matrix does not preserve majorness***From:*Yuanchen Zhu

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Submatrix of a matrix does not preserve majorness** - Next by Date:
**Re: [eigen] Submatrix of a matrix does not preserve majorness** - Previous by thread:
**[eigen] Submatrix of a matrix does not preserve majorness** - Next by thread:
**Re: [eigen] Submatrix of a matrix does not preserve majorness**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |