Bugzilla – Attachment 653 Details for
Bug 1166
MatrixXd block, VectorXd and noalias
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
Repro code
eigen_noalias.cc (text/x-c++src), 885 bytes, created by
Benjamin Chretien
on 2016-02-14 09:49:30 UTC
(
hide
)
Description:
Repro code
Filename:
MIME Type:
Creator:
Benjamin Chretien
Created:
2016-02-14 09:49:30 UTC
Size:
885 bytes
patch
obsolete
>#include <iostream> >#include <Eigen/Core> > >template <typename X> >void test(const X& x) >{ > Eigen::MatrixXd m(2, 2); > m.setZero(); > Eigen::MatrixXd a(2, 2); > a << 1., 2., 3., 4.; > > Eigen::Ref<Eigen::MatrixXd> b = m.block(1, 0, 1, 2); > > b.noalias() = 2. * x.transpose() * a; > std::cout << "With noalias():\n" << m << std::endl << std::endl; > m.setZero(); > > b = 2. * x.transpose() * a; > std::cout << "Without noalias():\n" << m << std::endl << std::endl; > m.setZero(); >} > >int main(int argc, char* argv[]) >{ > std::cout << "Eigen " << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION > << "." << EIGEN_MINOR_VERSION << std::endl; > > std::cout << "Using MatrixXd:" << std::endl; > Eigen::MatrixXd x_mat(2, 1); > x_mat << 3., 4.; > test(x_mat); > > std::cout << "Using VectorXd:" << std::endl; > Eigen::VectorXd x_vec(2); > x_vec << 3., 4.; > test(x_vec); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1166
: 653