aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar David Tellenbach <david.tellenbach@me.com>2021-02-17 00:50:26 +0100
committerGravatar David Tellenbach <david.tellenbach@me.com>2021-02-17 00:50:26 +0100
commit9ad4096ccb75dd5c5dd882576d49d48475afa300 (patch)
tree1cd53668a53a461db6a148c4276da125a649ba6a /doc
parentf702792a7c711e513974be6bf4d44d556ef4ccd8 (diff)
Document possible inconsistencies when using `Matrix<bool, ...>`
Diffstat (limited to 'doc')
-rw-r--r--doc/Pitfalls.dox21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/Pitfalls.dox b/doc/Pitfalls.dox
index 6760ce6d2..85282bd6f 100644
--- a/doc/Pitfalls.dox
+++ b/doc/Pitfalls.dox
@@ -124,5 +124,26 @@ There are at least two ways around this:
- If the value you are passing is guaranteed to be around for the life of the functor, you can use boost::ref() to wrap the value as you pass it to boost::bind. Generally this is not a solution for values on the stack as if the functor ever gets passed to a lower or independent scope, the object may be gone by the time it's attempted to be used.
- The other option is to make your functions take a reference counted pointer like boost::shared_ptr as the argument. This avoids needing to worry about managing the lifetime of the object being passed.
+
+\section TopicPitfalls_matrix_bool Matrices with boolean coefficients
+
+The current behaviour of using \c Matrix with boolean coefficients is inconsistent and likely to change in future versions of Eigen, so please use it carefully!
+
+A simple example for such an inconsistency is
+
+\code
+template<int Size>
+void foo() {
+ Eigen::Matrix<bool, Size, Size> A, B, C;
+ A.setOnes();
+ B.setOnes();
+
+ C = A * B - A * B;
+ std::cout << C << "\n";
+}
+\endcode
+
+since calling \c foo<3>() prints the zero matrix while calling \c foo<10>() prints the identity matrix.
+
*/
}