mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Unified LinSpaced in order to be conform with other setter methods as e.g. Constant.
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user