diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-28 15:56:18 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-28 15:56:18 +0000 |
commit | c3048e6d0ea32e4c7aeee2c142c9d90b42a1a080 (patch) | |
tree | fb979fb4cf4f8052c8cc66b1ec9516d91fcd859b /doc/examples/class_FixedReshaped.cpp | |
parent | fcf2af7ece3458fc79c6314d38441f356ab4a8b2 (diff) | |
parent | bc0f5df265caa21a2120c22453655a7fcc941991 (diff) | |
download | eigen-c3048e6d0ea32e4c7aeee2c142c9d90b42a1a080.tar.gz |
Snap for 8512216 from bc0f5df265caa21a2120c22453655a7fcc941991 to tm-frc-media-swcodec-releaset_frc_swc_330443040t_frc_swc_330443010android13-frc-media-swcodec-release
Change-Id: I9157ace1e25b57a243718a724a3d7a0d7805125a
Diffstat (limited to 'doc/examples/class_FixedReshaped.cpp')
-rw-r--r-- | doc/examples/class_FixedReshaped.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/examples/class_FixedReshaped.cpp b/doc/examples/class_FixedReshaped.cpp new file mode 100644 index 000000000..b6d4085de --- /dev/null +++ b/doc/examples/class_FixedReshaped.cpp @@ -0,0 +1,22 @@ +#include <Eigen/Core> +#include <iostream> +using namespace Eigen; +using namespace std; + +template<typename Derived> +Eigen::Reshaped<Derived, 4, 2> +reshape_helper(MatrixBase<Derived>& m) +{ + return Eigen::Reshaped<Derived, 4, 2>(m.derived()); +} + +int main(int, char**) +{ + MatrixXd m(2, 4); + m << 1, 2, 3, 4, + 5, 6, 7, 8; + MatrixXd n = reshape_helper(m); + cout << "matrix m is:" << endl << m << endl; + cout << "matrix n is:" << endl << n << endl; + return 0; +} |