mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 17:33:15 +08:00
Add missing const version of mat(all).
This commit is contained in:
parent
1e3aa470fa
commit
f8179385bd
@ -73,8 +73,15 @@ reshaped(NRowsType nRows, NColsType nCols, OrderType) const
|
|||||||
// Views as linear vectors
|
// Views as linear vectors
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
inline const Reshaped<const Derived,SizeAtCompileTime,1>
|
inline const Reshaped<Derived,SizeAtCompileTime,1>
|
||||||
operator()(const Eigen::internal::all_t&)
|
operator()(const Eigen::internal::all_t&)
|
||||||
|
{
|
||||||
|
return Reshaped<Derived,SizeAtCompileTime,1>(derived(),size(),1);
|
||||||
|
}
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
inline const Reshaped<const Derived,SizeAtCompileTime,1>
|
||||||
|
operator()(const Eigen::internal::all_t&) const
|
||||||
{
|
{
|
||||||
return Reshaped<const Derived,SizeAtCompileTime,1>(derived(),size(),1);
|
return Reshaped<const Derived,SizeAtCompileTime,1>(derived(),size(),1);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
template<typename T1,typename T2>
|
||||||
|
typename internal::enable_if<internal::is_same<T1,T2>::value,bool>::type
|
||||||
|
is_same_eq(const T1& a, const T2& b)
|
||||||
|
{
|
||||||
|
return (a.array() == b.array()).all();
|
||||||
|
}
|
||||||
|
|
||||||
// just test a 4x4 matrix, enumerate all combination manually
|
// just test a 4x4 matrix, enumerate all combination manually
|
||||||
template <typename MatType>
|
template <typename MatType>
|
||||||
void reshape4x4(MatType m)
|
void reshape4x4(MatType m)
|
||||||
@ -75,6 +82,7 @@ void reshape4x4(MatType m)
|
|||||||
VERIFY_IS_EQUAL( m28r1, m28r2);
|
VERIFY_IS_EQUAL( m28r1, m28r2);
|
||||||
|
|
||||||
using placeholders::all;
|
using placeholders::all;
|
||||||
|
VERIFY(is_same_eq(m.reshaped(fix<MatType::SizeAtCompileTime>(m.size()),fix<1>), m(all)));
|
||||||
VERIFY_IS_EQUAL(m.reshaped(16,1), m(all));
|
VERIFY_IS_EQUAL(m.reshaped(16,1), m(all));
|
||||||
VERIFY_IS_EQUAL(m.reshaped(1,16), m(all).transpose());
|
VERIFY_IS_EQUAL(m.reshaped(1,16), m(all).transpose());
|
||||||
VERIFY_IS_EQUAL(m(all).reshaped(2,8), m.reshaped(2,8));
|
VERIFY_IS_EQUAL(m(all).reshaped(2,8), m.reshaped(2,8));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user