Unified LinSpaced in order to be conform with other setter methods as e.g. Constant.

This commit is contained in:
Hauke Heibel
2010-07-22 14:04:00 +02:00
parent 8e21cef80a
commit 734469e43f
7 changed files with 51 additions and 20 deletions

View File

@@ -59,7 +59,7 @@ void testVectorType(const VectorType& base)
// check whether the result yields what we expect it to do
VectorType m(base);
m.setLinSpaced(low,high,size);
m.setLinSpaced(size,low,high);
VectorType n(size);
for (int i=0; i<size; ++i)
@@ -68,7 +68,7 @@ void testVectorType(const VectorType& base)
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
// random access version
m = VectorType::LinSpaced(low,high,size);
m = VectorType::LinSpaced(size,low,high);
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
// These guys sometimes fail! This is not good. Any ideas how to fix them!?
@@ -76,7 +76,7 @@ void testVectorType(const VectorType& base)
//VERIFY( m(0) == low );
// sequential access version
m = VectorType::LinSpaced(Sequential,low,high,size);
m = VectorType::LinSpaced(Sequential,size,low,high);
VERIFY( (m-n).norm() < std::numeric_limits<Scalar>::epsilon()*10e3 );
// These guys sometimes fail! This is not good. Any ideas how to fix them!?
@@ -86,12 +86,12 @@ void testVectorType(const VectorType& base)
// check whether everything works with row and col major vectors
Matrix<Scalar,Dynamic,1> row_vector(size);
Matrix<Scalar,1,Dynamic> col_vector(size);
row_vector.setLinSpaced(low,high,size);
col_vector.setLinSpaced(low,high,size);
row_vector.setLinSpaced(size,low,high);
col_vector.setLinSpaced(size,low,high);
VERIFY( row_vector.isApprox(col_vector.transpose(), NumTraits<Scalar>::epsilon()));
Matrix<Scalar,Dynamic,1> size_changer(size+50);
size_changer.setLinSpaced(low,high,size);
size_changer.setLinSpaced(size,low,high);
VERIFY( size_changer.size() == size );
}