aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/nullary.cpp
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2012-03-07 15:34:39 +0100
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2012-03-07 15:34:39 +0100
commitef022da28e51632458f92baabb539bf13a221694 (patch)
tree8d05f4a9ffedf1becef9a7a063086ef4a5f02545 /test/nullary.cpp
parent81c1336ab8135d81b261728c3560fc3bfffbb5c5 (diff)
Fixed setLinSpaced for size==1.
Diffstat (limited to 'test/nullary.cpp')
-rw-r--r--test/nullary.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/nullary.cpp b/test/nullary.cpp
index 0df15c081..501b579b0 100644
--- a/test/nullary.cpp
+++ b/test/nullary.cpp
@@ -76,8 +76,8 @@ void testVectorType(const VectorType& base)
VERIFY( (MatrixXd(RowVectorXd::LinSpaced(3, 0, 1)) - RowVector3d(0, 0.5, 1)).norm() < std::numeric_limits<Scalar>::epsilon() );
// These guys sometimes fail! This is not good. Any ideas how to fix them!?
-// VERIFY( m(m.size()-1) == high );
-// VERIFY( m(0) == low );
+ //VERIFY( m(m.size()-1) == high );
+ //VERIFY( m(0) == low );
// sequential access version
m = VectorType::LinSpaced(Sequential,size,low,high);
@@ -97,6 +97,12 @@ void testVectorType(const VectorType& base)
Matrix<Scalar,Dynamic,1> size_changer(size+50);
size_changer.setLinSpaced(size,low,high);
VERIFY( size_changer.size() == size );
+
+ typedef Matrix<Scalar,1,1> ScalarMatrix;
+ ScalarMatrix scalar;
+ scalar.setLinSpaced(1,low,high);
+ VERIFY_IS_APPROX( scalar, ScalarMatrix::Constant(high) );
+ VERIFY_IS_APPROX( ScalarMatrix::LinSpaced(1,low,high), ScalarMatrix::Constant(high) );
}
template<typename MatrixType>