mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
bugfix: issue #2375
This commit is contained in:
parent
eb85b97339
commit
1b8dce564a
@ -23,8 +23,8 @@ struct traits<IndexedView<XprType, RowIndices, ColIndices> >
|
|||||||
enum {
|
enum {
|
||||||
RowsAtCompileTime = int(array_size<RowIndices>::value),
|
RowsAtCompileTime = int(array_size<RowIndices>::value),
|
||||||
ColsAtCompileTime = int(array_size<ColIndices>::value),
|
ColsAtCompileTime = int(array_size<ColIndices>::value),
|
||||||
MaxRowsAtCompileTime = RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) : Dynamic,
|
MaxRowsAtCompileTime = RowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : Dynamic,
|
MaxColsAtCompileTime = ColsAtCompileTime,
|
||||||
|
|
||||||
XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0,
|
XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0,
|
||||||
IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
|
IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
|
||||||
@ -44,8 +44,8 @@ struct traits<IndexedView<XprType, RowIndices, ColIndices> >
|
|||||||
IsBlockAlike = InnerIncr==1 && OuterIncr==1,
|
IsBlockAlike = InnerIncr==1 && OuterIncr==1,
|
||||||
IsInnerPannel = HasSameStorageOrderAsXprType && is_same<AllRange<InnerSize>,typename conditional<XprTypeIsRowMajor,ColIndices,RowIndices>::type>::value,
|
IsInnerPannel = HasSameStorageOrderAsXprType && is_same<AllRange<InnerSize>,typename conditional<XprTypeIsRowMajor,ColIndices,RowIndices>::type>::value,
|
||||||
|
|
||||||
InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic ? Dynamic : XprInnerStride * InnerIncr,
|
InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic || InnerIncr==UndefinedIncr ? Dynamic : XprInnerStride * InnerIncr,
|
||||||
OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic ? Dynamic : XprOuterstride * OuterIncr,
|
OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic || OuterIncr==UndefinedIncr ? Dynamic : XprOuterstride * OuterIncr,
|
||||||
|
|
||||||
ReturnAsScalar = is_same<RowIndices,SingleRange>::value && is_same<ColIndices,SingleRange>::value,
|
ReturnAsScalar = is_same<RowIndices,SingleRange>::value && is_same<ColIndices,SingleRange>::value,
|
||||||
ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike,
|
ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike,
|
||||||
|
@ -414,6 +414,18 @@ void check_indexed_view()
|
|||||||
VERIFY( MATCH( A(all,1)(1), "101"));
|
VERIFY( MATCH( A(all,1)(1), "101"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||||
|
// bug #2375: indexing over matrices of dim >128 should compile on gcc
|
||||||
|
{
|
||||||
|
Matrix<double, 513, 3> large_mat = Matrix<double, 513, 3>::Random();
|
||||||
|
std::array<int, 2> test_indices = {0, 1};
|
||||||
|
Matrix<double, 513, 2> thin_slice = large_mat(all, test_indices);
|
||||||
|
for(int col = 0; col < int(test_indices.size()); ++col)
|
||||||
|
for(int row = 0; row < large_mat.rows(); ++row)
|
||||||
|
VERIFY_IS_EQUAL( thin_slice(row, col), large_mat(row, col) );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Bug IndexView with a single static row should be RowMajor:
|
//Bug IndexView with a single static row should be RowMajor:
|
||||||
{
|
{
|
||||||
// A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval();
|
// A(1, seq(0,2,1)).cwiseAbs().colwise().replicate(2).eval();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user