Registered Member
|
Hi,
the code at the end gives very strange error messages (at least for beginners) How to implement the Matlab/Scilab notation A= 2*(A-0.5) in an elegant way. I tried (failed miserably) #include using std::cout; using std::endl; #include using std::log; using std::sqrt; #include // import most common Eigen types USING_PART_OF_NAMESPACE_EIGEN int main() { int N=5; MatrixXd A = MatrixXd::Random(N,N); A= 2*(A.cwise()-0.5); // transform matrix elements to be in [-1,1) cout << "A=n" << A << endl; } Thanks for a hint, Helmut. |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell