mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-21 09:09:36 +08:00
tutorial: add the cast function
This commit is contained in:
parent
a3b89e0ee6
commit
cc6121b98d
@ -188,6 +188,15 @@ v = 6 6 6
|
|||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
|
|
||||||
|
|
||||||
|
\subsection TutorialCasting Casting
|
||||||
|
|
||||||
|
In Eigen, any matrices of same size and same scalar type are all naturally compatible. The scalar type can be explicitely casted to another one using the template cast() function:
|
||||||
|
\code
|
||||||
|
Matrix3d md(1,2,3);
|
||||||
|
Matrix3f mf = md.cast<float>();
|
||||||
|
\endcode
|
||||||
|
Note that casting to the same scalar type in an expression is free.
|
||||||
|
|
||||||
|
|
||||||
\subsection TutorialMap Map
|
\subsection TutorialMap Map
|
||||||
Any memory buffer can be mapped as an Eigen expression:
|
Any memory buffer can be mapped as an Eigen expression:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user