Registered Member
|
Hi,
I have the following piece of code. I was expecting a run-time error but did not get it. I was wondering if anyone has any inputs. typedef Eigen::Matrix<double,6,6> Matrix6d; Matrix6d P; P << 10, 0, 0, 0, 0, 0, 0, 10, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1; Eigen::internal::set_is_malloc_allowed(false); P = P*P; Eigen::internal::set_is_malloc_allowed(true); My understanding is that P=P*P requires the creation of a temporary variable. I thought the temporary variable will be dynamically allocated on the heap. Hence I was expecting an error. Or is Eigen creating the temporary variable on the stack? I appreciate any inputs. Thanks ! ps: I have defined the macro EIGEN_RUNTIME_NO_MALLOC in my code |
Registered Member
|
Fixed-size matrices are created on the stack. If you use a dynamic-size matrix (MatrixXd), you do get a run-time error.
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell