From 53c77061f08d220db9955b91b30f65e5d13c6277 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 24 Oct 2016 15:50:27 +0200 Subject: bug #698: rewrite LinSpaced for integer scalar types to avoid overflow and guarantee an even spacing when possible. Otherwise, the "high" bound is implicitly lowered to the largest value allowing for an even distribution. This changeset also disable vectorization for this integer path. --- doc/snippets/DenseBase_LinSpacedInt.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/snippets/DenseBase_LinSpacedInt.cpp (limited to 'doc/snippets') diff --git a/doc/snippets/DenseBase_LinSpacedInt.cpp b/doc/snippets/DenseBase_LinSpacedInt.cpp new file mode 100644 index 000000000..0d7ae068e --- /dev/null +++ b/doc/snippets/DenseBase_LinSpacedInt.cpp @@ -0,0 +1,8 @@ +cout << "Even spacing inputs:" << endl; +cout << VectorXi::LinSpaced(8,1,4).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,8).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,15).transpose() << endl; +cout << "Uneven spacing inputs:" << endl; +cout << VectorXi::LinSpaced(8,1,7).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,9).transpose() << endl; +cout << VectorXi::LinSpaced(8,1,16).transpose() << endl; -- cgit v1.2.3