mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Use wrapper macro for multidimensional subscript feature test
See merge request libeigen/eigen!2059
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
63fc0bc8c1
commit
06f5cb4878
@@ -113,7 +113,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
|
|||||||
return coeff(row, col);
|
return coeff(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
/** \returns the coefficient at given the given row and column.
|
/** \returns the coefficient at given the given row and column.
|
||||||
*
|
*
|
||||||
* \sa operator[](Index,Index), operator[](Index)
|
* \sa operator[](Index,Index), operator[](Index)
|
||||||
@@ -331,7 +331,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
|
|||||||
return coeffRef(row, col);
|
return coeffRef(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
/** \returns a reference to the coefficient at given the given row and column.
|
/** \returns a reference to the coefficient at given the given row and column.
|
||||||
*
|
*
|
||||||
* \sa operator[](Index)
|
* \sa operator[](Index)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class TriangularBase : public EigenBase<Derived> {
|
|||||||
return coeffRef(row, col);
|
return coeffRef(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return operator()(row, col); }
|
EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return operator()(row, col); }
|
||||||
EIGEN_DEVICE_FUNC inline Scalar& operator[](Index row, Index col) { return operator()(row, col); }
|
EIGEN_DEVICE_FUNC inline Scalar& operator[](Index row, Index col) { return operator()(row, col); }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -830,6 +830,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Multidimensional subscript operator feature test
|
||||||
|
#if defined(__cpp_multidimensional_subscript) && __cpp_multidimensional_subscript >= 202110L
|
||||||
|
#define EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
// Preprocessor programming helpers
|
// Preprocessor programming helpers
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ class Transform {
|
|||||||
* \sa MatrixBase::operator(Index,Index) */
|
* \sa MatrixBase::operator(Index,Index) */
|
||||||
EIGEN_DEVICE_FUNC inline Scalar& operator()(Index row, Index col) { return m_matrix(row, col); }
|
EIGEN_DEVICE_FUNC inline Scalar& operator()(Index row, Index col) { return m_matrix(row, col); }
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
/** shortcut for m_matrix(row,col);
|
/** shortcut for m_matrix(row,col);
|
||||||
* \sa MatrixBase::operator(Index,Index) const */
|
* \sa MatrixBase::operator(Index,Index) const */
|
||||||
EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return m_matrix[row, col]; }
|
EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return m_matrix[row, col]; }
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class SimpleTensorContractionMapper {
|
|||||||
return m_tensor.coeff(computeIndex(row, col));
|
return m_tensor.coeff(computeIndex(row, col));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator[](Index row, Index col) const { return operator()(row, col); }
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator[](Index row, Index col) const { return operator()(row, col); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class companion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
EIGEN_STRONG_INLINE const Scalar_ operator[](Index row, Index col) const { return operator()(row, col); }
|
EIGEN_STRONG_INLINE const Scalar_ operator[](Index row, Index col) const { return operator()(row, col); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class RandomSetter {
|
|||||||
return m_hashmaps[outerMajor][key].value;
|
return m_hashmaps[outerMajor][key].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cpp_multidimensional_subscript >= 202110L
|
#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT
|
||||||
/** \returns a reference to the coefficient at given coordinates \a row, \a col */
|
/** \returns a reference to the coefficient at given coordinates \a row, \a col */
|
||||||
Scalar& operator[](Index row, Index col) { return operator()(row, col); }
|
Scalar& operator[](Index row, Index col) { return operator()(row, col); }
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user