Re: [eigen] Matrix types - please explain! |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Matrix types - please explain!
- From: Hauke Heibel <hauke.heibel@xxxxxxxxx>
- Date: Fri, 21 Sep 2012 09:13:59 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=KBEbzhmvuq1HzSYwX29dN9uBP/RL493+e/n8fARiH00=; b=sMA8KiLp8QJiLfqHMzaxrpTPwu0DZeR0MT/LX4vU69k8RuymJK5Yflec0A69QyoBiX Pki6kgYstSrWeTPecEw0dzU6x5twMRgw1VuM5RssoAY4INjnElZwVLjVRpE8qQrJwY+M mpsPGPARDC18lSiCtXJ5Mahmv0+RfDtNhq7DQlsQo1PUAgtlfxCeYcUFkPl5oGRHLwHc hmob4boUCaEnMCchJRZxWfaotxba4tV6XuF/jM3tTOXQq/6XwYZBXc4xfWTcodwuhhOO pPlmftS9lNba2YRD81txCQUlRkvsc+UGmDkdZVH599rhoJYXVfkUNexe7aEPSveXNMYv RROw==
Hi Helmut,
On Thu, Sep 20, 2012 at 6:33 PM, Helmut Jarausch
<jarausch@xxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> looking for the type of expressions like
> Mat.block(.....) and Mat.topRightConer(..), etc
>
> I have seen the following types in test/householder.cpp :
>
> typedef Matrix<Scalar, MatrixType::RowsAtCompileTime,
> MatrixType::RowsAtCompileTime> SquareMatrixType;
> typedef Matrix<Scalar, MatrixType::ColsAtCompileTime,
> MatrixType::ColsAtCompileTime> RightSquareMatrixType;
> typedef Matrix<Scalar, MatrixType::ColsAtCompileTime,
> MatrixType::RowsAtCompileTime> TMatrixType;
>
> typedef Matrix<Scalar, Dynamic, MatrixType::ColsAtCompileTime>
> HBlockMatrixType;
> typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic>
> VBlockMatrixType;
>
>
> Can anybody please explain the difference?
1) SquareMatrixType/RightSquareMatrixType
Advantageous when RowsAtCompileTime != Eigen::Dynamic or
ColsAtCompileTime != Dynamic.
Example: Matrix<Scalar,2,3>
SquareMatrixType = Matrix<Scalar,2,2> without the need of dynamic allocations.
RightSquareMatrixType = Matrix<Scalar,3,3> without the need of dynamic
allocations.
2) TMatrixType
Looks like the transposed matrix type.
Example: Matrix<Scalar,2,3>
TMatrixType = Matrix<Scalar,3,2> again without the need of dynamic allocations
3) H/VBlockMatrixType
a) The dense type a class Block with dynamic rows and fixed size
columns could be assigned to.
b) The dense type a class Block with fixed rows and dynamic columns
could be assigned to.
I have to admit that I am a little bit confused by the naming since I
thought H=horizontal and V=vertical and I assumed further that H/V
indicated the dynamic dimension.
> MatrixXd Mat;
> auto SubMatrix= Mat.block(i,j,rows,cols);
None of the above. SubMatrix would be of type Block (expression type
that behaves a little bit like a matrix but does not right away copy
the data until you assign the object). You could find out via
Eigen::MatrixXd mat(10,10);
auto sub_matrix = mat.block(0,0,5,5);
std::cout << typeid(sub_matrix).name() << std::endl;
I hope that helps a bit and that I got nothing wrong.
Regards,
Hauke