Remove redundant EIGEN_STRONG_INLINE from trivial constexpr and = default functions

libeigen/eigen!2161

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-20 19:50:52 -08:00
parent e0a8d6c9d8
commit 270ea539fa
26 changed files with 274 additions and 333 deletions

View File

@@ -123,12 +123,12 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
* \sa resize(Index,Index)
*/
#ifdef EIGEN_INITIALIZE_COEFFS
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array() : Base() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
EIGEN_DEVICE_FUNC constexpr Array() : Base() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array() = default;
EIGEN_DEVICE_FUNC constexpr Array() = default;
#endif
/** \brief Move constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(Array&&) = default;
EIGEN_DEVICE_FUNC constexpr Array(Array&&) = default;
EIGEN_DEVICE_FUNC Array& operator=(Array&& other) noexcept(std::is_nothrow_move_assignable<Scalar>::value) {
Base::operator=(std::move(other));
return *this;
@@ -178,9 +178,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
*
* \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(
const std::initializer_list<std::initializer_list<Scalar>>& list)
: Base(list) {}
EIGEN_DEVICE_FUNC constexpr Array(const std::initializer_list<std::initializer_list<Scalar>>& list) : Base(list) {}
#ifndef EIGEN_PARSED_BY_DOXYGEN
template <typename T>
@@ -239,7 +237,7 @@ class Array : public PlainObjectBase<Array<Scalar_, Rows_, Cols_, Options_, MaxR
}
/** Copy constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Array(const Array&) = default;
EIGEN_DEVICE_FUNC constexpr Array(const Array&) = default;
private:
struct PrivateType {};

View File

@@ -289,9 +289,9 @@ class BlockImpl_dense : public internal::dense_xpr_base<Block<XprType, BlockRows
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE XprType& nestedExpression() { return m_xpr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
protected:
XprTypeNested m_xpr;
@@ -380,18 +380,18 @@ class BlockImpl_dense<XprType, BlockRows, BlockCols, InnerPanel, true>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE XprType& nestedExpression() { return m_xpr; }
/** \sa MapBase::innerStride() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index innerStride() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index innerStride() const noexcept {
return internal::traits<BlockType>::HasSameStorageOrderAsXprType ? m_xpr.innerStride() : m_xpr.outerStride();
}
/** \sa MapBase::outerStride() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index outerStride() const noexcept {
return internal::traits<BlockType>::HasSameStorageOrderAsXprType ? m_xpr.outerStride() : m_xpr.innerStride();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startRow() const noexcept { return m_startRow.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
EIGEN_DEVICE_FUNC constexpr StorageIndex startCol() const noexcept { return m_startCol.value(); }
#ifndef __SUNPRO_CC
// FIXME sunstudio is not friendly with the above friend...

View File

@@ -124,7 +124,7 @@ struct evaluator_base {
// noncopyable:
// Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization)
// and make complex evaluator much larger than then should do.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator_base() = default;
EIGEN_DEVICE_FUNC constexpr evaluator_base() = default;
private:
EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base&);
@@ -142,23 +142,22 @@ struct evaluator_base {
template <typename Scalar, int OuterStride>
class plainobjectbase_evaluator_data {
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride)
: data(ptr) {
EIGEN_DEVICE_FUNC constexpr plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr) {
#ifndef EIGEN_INTERNAL_DEBUGGING
EIGEN_UNUSED_VARIABLE(outerStride);
#endif
eigen_internal_assert(outerStride == OuterStride);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const noexcept { return OuterStride; }
EIGEN_DEVICE_FUNC constexpr Index outerStride() const noexcept { return OuterStride; }
const Scalar* data;
};
template <typename Scalar>
class plainobjectbase_evaluator_data<Scalar, Dynamic> {
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride)
EIGEN_DEVICE_FUNC constexpr plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride)
: data(ptr), m_outerStride(outerStride) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const { return m_outerStride; }
EIGEN_DEVICE_FUNC constexpr Index outerStride() const { return m_outerStride; }
const Scalar* data;
protected:
@@ -188,11 +187,11 @@ struct evaluator<PlainObjectBase<Derived>> : evaluator_base<Derived> {
: RowsAtCompileTime
};
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() : m_d(0, OuterStrideAtCompileTime) {
EIGEN_DEVICE_FUNC constexpr evaluator() : m_d(0, OuterStrideAtCompileTime) {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr explicit evaluator(const PlainObjectType& m)
EIGEN_DEVICE_FUNC constexpr explicit evaluator(const PlainObjectType& m)
: m_d(m.data(), IsVectorAtCompileTime ? 0 : m.outerStride()) {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
@@ -257,7 +256,7 @@ struct evaluator<PlainObjectBase<Derived>> : evaluator_base<Derived> {
plainobjectbase_evaluator_data<Scalar, OuterStrideAtCompileTime> m_d;
private:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index constexpr getIndex(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr Index getIndex(Index row, Index col) const {
return IsRowMajor ? row * m_d.outerStride() + col : row + col * m_d.outerStride();
}
};
@@ -267,10 +266,9 @@ struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
: evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>> {
typedef Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> XprType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() = default;
EIGEN_DEVICE_FUNC constexpr evaluator() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr explicit evaluator(const XprType& m)
: evaluator<PlainObjectBase<XprType>>(m) {}
EIGEN_DEVICE_FUNC constexpr explicit evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType>>(m) {}
};
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
@@ -278,10 +276,9 @@ struct evaluator<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
: evaluator<PlainObjectBase<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>> {
typedef Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> XprType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() = default;
EIGEN_DEVICE_FUNC constexpr evaluator() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr explicit evaluator(const XprType& m)
: evaluator<PlainObjectBase<XprType>>(m) {}
EIGEN_DEVICE_FUNC constexpr explicit evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType>>(m) {}
};
// -------------------- Transpose --------------------
@@ -1309,10 +1306,10 @@ struct mapbase_evaluator : evaluator_base<Derived> {
}
protected:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rowStride() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index rowStride() const noexcept {
return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index colStride() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index colStride() const noexcept {
return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value();
}
@@ -1954,12 +1951,8 @@ struct evaluator<Diagonal<ArgType, DiagIndex>> : evaluator_base<Diagonal<ArgType
const variable_if_dynamicindex<Index, XprType::DiagIndex> m_index;
private:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rowOffset() const {
return m_index.value() > 0 ? 0 : -m_index.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index colOffset() const {
return m_index.value() > 0 ? m_index.value() : 0;
}
EIGEN_DEVICE_FUNC constexpr Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); }
EIGEN_DEVICE_FUNC constexpr Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; }
};
//----------------------------------------------------------------------

View File

@@ -108,12 +108,12 @@ class CwiseBinaryOp : public CwiseBinaryOpImpl<BinaryOp, LhsType, RhsType,
eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept {
// return the fixed size type if available to enable compile time optimizations
return internal::traits<internal::remove_all_t<LhsNested>>::RowsAtCompileTime == Dynamic ? m_rhs.rows()
: m_lhs.rows();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept {
// return the fixed size type if available to enable compile time optimizations
return internal::traits<internal::remove_all_t<LhsNested>>::ColsAtCompileTime == Dynamic ? m_rhs.cols()
: m_lhs.cols();

View File

@@ -76,8 +76,8 @@ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp,
EIGEN_STATIC_ASSERT(CwiseNullaryOp::IsVectorAtCompileTime, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols.value(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows.value(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols.value(); }
/** \returns the functor representing the nullary operation */
EIGEN_DEVICE_FUNC const NullaryOp& functor() const { return m_functor; }

View File

@@ -60,8 +60,8 @@ class CwiseUnaryOp : public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
: m_xpr(xpr), m_functor(func) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_xpr.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_xpr.cols(); }
/** \returns the functor representing the unary operation */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& functor() const { return m_functor; }

View File

@@ -145,8 +145,8 @@ class CwiseUnaryView : public internal::CwiseUnaryViewImpl<ViewOp, MatrixType, S
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_matrix.cols(); }
/** \returns the functor representing unary operation */
EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; }

View File

@@ -95,12 +95,12 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
*
* \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType coeff(Index row, Index col) const {
eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return internal::evaluator<Derived>(derived()).coeff(row, col);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeffByOuterInner(Index outer, Index inner) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType coeffByOuterInner(Index outer, Index inner) const {
return coeff(rowIndexByOuterInner(outer, inner), colIndexByOuterInner(outer, inner));
}
@@ -108,7 +108,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
*
* \sa operator()(Index,Index), operator[](Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator()(Index row, Index col) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator()(Index row, Index col) const {
eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return coeff(row, col);
}
@@ -118,9 +118,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
*
* \sa operator[](Index,Index), operator[](Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator[](Index row, Index col) const {
return operator()(row, col);
}
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator[](Index row, Index col) const { return operator()(row, col); }
#endif
/** Short version: don't use this function, use
@@ -138,7 +136,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
* \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index index) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType coeff(Index index) const {
EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
eigen_internal_assert(index >= 0 && index < size());
@@ -153,7 +151,7 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
* z() const, w() const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator[](Index index) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator[](Index index) const {
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
eigen_assert(index >= 0 && index < size());
@@ -170,32 +168,32 @@ class DenseCoeffsBase<Derived, ReadOnlyAccessors> : public EigenBase<Derived> {
* z() const, w() const
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator()(Index index) const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType operator()(Index index) const {
eigen_assert(index >= 0 && index < size());
return coeff(index);
}
/** equivalent to operator[](0). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType x() const { return (*this)[0]; }
EIGEN_DEVICE_FUNC constexpr CoeffReturnType x() const { return (*this)[0]; }
/** equivalent to operator[](1). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType y() const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType y() const {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 2, OUT_OF_RANGE_ACCESS);
return (*this)[1];
}
/** equivalent to operator[](2). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType z() const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType z() const {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 3, OUT_OF_RANGE_ACCESS);
return (*this)[2];
}
/** equivalent to operator[](3). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType w() const {
EIGEN_DEVICE_FUNC constexpr CoeffReturnType w() const {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 4, OUT_OF_RANGE_ACCESS);
return (*this)[3];
}
@@ -313,7 +311,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
*
* \sa operator()(Index,Index), coeff(Index, Index) const, coeffRef(Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index row, Index col) {
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index row, Index col) {
eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return internal::evaluator<Derived>(derived()).coeffRef(row, col);
}
@@ -326,7 +324,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
*
* \sa operator[](Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator()(Index row, Index col) {
EIGEN_DEVICE_FUNC constexpr Scalar& operator()(Index row, Index col) {
eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
return coeffRef(row, col);
}
@@ -336,9 +334,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
*
* \sa operator[](Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator[](Index row, Index col) {
return operator()(row, col);
}
EIGEN_DEVICE_FUNC constexpr Scalar& operator[](Index row, Index col) { return operator()(row, col); }
#endif
/** Short version: don't use this function, use
@@ -356,7 +352,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
* \sa operator[](Index), coeff(Index) const, coeffRef(Index,Index)
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) {
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index index) {
EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS)
eigen_internal_assert(index >= 0 && index < size());
@@ -370,7 +366,7 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
* \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w()
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator[](Index index) {
EIGEN_DEVICE_FUNC constexpr Scalar& operator[](Index index) {
EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime,
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD)
eigen_assert(index >= 0 && index < size());
@@ -386,32 +382,32 @@ class DenseCoeffsBase<Derived, WriteAccessors> : public DenseCoeffsBase<Derived,
* \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w()
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator()(Index index) {
EIGEN_DEVICE_FUNC constexpr Scalar& operator()(Index index) {
eigen_assert(index >= 0 && index < size());
return coeffRef(index);
}
/** equivalent to operator[](0). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& x() { return (*this)[0]; }
EIGEN_DEVICE_FUNC constexpr Scalar& x() { return (*this)[0]; }
/** equivalent to operator[](1). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& y() {
EIGEN_DEVICE_FUNC constexpr Scalar& y() {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 2, OUT_OF_RANGE_ACCESS);
return (*this)[1];
}
/** equivalent to operator[](2). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& z() {
EIGEN_DEVICE_FUNC constexpr Scalar& z() {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 3, OUT_OF_RANGE_ACCESS);
return (*this)[2];
}
/** equivalent to operator[](3). */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& w() {
EIGEN_DEVICE_FUNC constexpr Scalar& w() {
EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime == -1 || Derived::SizeAtCompileTime >= 4, OUT_OF_RANGE_ACCESS);
return (*this)[3];
}

View File

@@ -54,7 +54,7 @@ template <typename T, int Size, int MatrixOrArrayOptions,
struct plain_array {
EIGEN_ALIGN_TO_BOUNDARY(Alignment) T array[Size];
#if defined(EIGEN_NO_DEBUG) || defined(EIGEN_TESTING_PLAINOBJECT_CTOR)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
EIGEN_DEVICE_FUNC constexpr plain_array() = default;
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() {
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(Alignment)
@@ -68,7 +68,7 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 0> {
// on some 32-bit platforms, stack-allocated arrays are aligned to 4 bytes, not the preferred alignment of T
EIGEN_ALIGN_TO_BOUNDARY(alignof(T)) T array[Size];
#if defined(EIGEN_NO_DEBUG) || defined(EIGEN_TESTING_PLAINOBJECT_CTOR)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() = default;
EIGEN_DEVICE_FUNC constexpr plain_array() = default;
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plain_array() { EIGEN_MAKE_STACK_ALLOCATION_ASSERT(Size * sizeof(T)) }
#endif
@@ -92,8 +92,8 @@ class DenseStorage_impl {
public:
#ifndef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size)
@@ -103,19 +103,18 @@ class DenseStorage_impl {
smart_copy(other.m_data.array, other.m_data.array + Size, m_data.array);
}
#endif
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) {
numext::swap(m_data, other.m_data);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/,
Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
template <typename T, int Size, int Cols, int Options>
class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
@@ -123,7 +122,7 @@ class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
Index m_rows = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_rows(other.m_rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -143,17 +142,13 @@ class DenseStorage_impl<T, Size, Dynamic, Cols, Options> {
swap_plain_array(m_data, other.m_data, size(), other.size());
numext::swap(m_rows, other.m_rows);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
template <typename T, int Size, int Rows, int Options>
class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
@@ -161,7 +156,7 @@ class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -181,17 +176,13 @@ class DenseStorage_impl<T, Size, Rows, Dynamic, Options> {
swap_plain_array(m_data, other.m_data, size(), other.size());
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
template <typename T, int Size, int Options>
class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
@@ -200,7 +191,7 @@ class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_rows(other.m_rows), m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -222,87 +213,72 @@ class DenseStorage_impl<T, Size, Dynamic, Dynamic, Options> {
numext::swap(m_rows, other.m_rows);
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data.array; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data.array; }
};
// null matrix variants
template <typename T, int Rows, int Cols, int Options>
class DenseStorage_impl<T, 0, Rows, Cols, Options> {
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl&) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/,
Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl&) {}
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index /*cols*/) {}
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
template <typename T, int Cols, int Options>
class DenseStorage_impl<T, 0, Dynamic, Cols, Options> {
Index m_rows = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index rows, Index /*cols*/)
: m_rows(rows) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_rows, other.m_rows);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) {
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index rows, Index /*cols*/) : m_rows(rows) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept { numext::swap(m_rows, other.m_rows); }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index /*cols*/) { m_rows = rows; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
template <typename T, int Rows, int Options>
class DenseStorage_impl<T, 0, Rows, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index cols)
: m_cols(cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) {
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index /*rows*/, Index cols) : m_cols(cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept { numext::swap(m_cols, other.m_cols); }
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index /*rows*/, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
template <typename T, int Options>
class DenseStorage_impl<T, 0, Dynamic, Dynamic, Options> {
@@ -310,28 +286,27 @@ class DenseStorage_impl<T, 0, Dynamic, Dynamic, Options> {
Index m_cols = 0;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(Index /*size*/, Index rows, Index cols)
: m_rows(rows), m_cols(cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(Index /*size*/, Index rows, Index cols) : m_rows(rows), m_cols(cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(const DenseStorage_impl&) = default;
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_rows, other.m_rows);
numext::swap(m_cols, other.m_cols);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void conservativeResize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index /*size*/, Index rows, Index cols) {
EIGEN_DEVICE_FUNC constexpr void resize(Index /*size*/, Index rows, Index cols) {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return nullptr; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return nullptr; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return nullptr; }
};
// fixed-size matrix with dynamic memory allocation not currently supported
template <typename T, int Rows, int Cols, int Options>
@@ -345,7 +320,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
public:
static constexpr int Size = Dynamic;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_data(conditional_aligned_new_auto<T, Align>(other.size())), m_rows(other.m_rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -355,7 +330,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
: m_data(conditional_aligned_new_auto<T, Align>(size)), m_rows(rows) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
: m_data(other.m_data), m_rows(other.m_rows) {
other.m_data = nullptr;
other.m_rows = 0;
@@ -366,11 +341,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
smart_copy(other.m_data, other.m_data + other.size(), m_data);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
this->swap(other);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_data, other.m_data);
numext::swap(m_rows, other.m_rows);
}
@@ -387,11 +362,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Cols, Options> {
}
m_rows = rows;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return Cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * Cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
};
template <typename T, int Rows, int Options>
class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
@@ -401,7 +376,7 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
public:
static constexpr int Size = Dynamic;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_data(conditional_aligned_new_auto<T, Align>(other.size())), m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -411,7 +386,7 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
: m_data(conditional_aligned_new_auto<T, Align>(size)), m_cols(cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
: m_data(other.m_data), m_cols(other.m_cols) {
other.m_data = nullptr;
other.m_cols = 0;
@@ -422,11 +397,11 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
smart_copy(other.m_data, other.m_data + other.size(), m_data);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
this->swap(other);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_data, other.m_data);
numext::swap(m_cols, other.m_cols);
}
@@ -443,11 +418,11 @@ class DenseStorage_impl<T, Dynamic, Rows, Dynamic, Options> {
}
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return Rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return Rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
};
template <typename T, int Options>
class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
@@ -458,7 +433,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
public:
static constexpr int Size = Dynamic;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(const DenseStorage_impl& other)
: m_data(conditional_aligned_new_auto<T, Align>(other.size())), m_rows(other.m_rows), m_cols(other.m_cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = other.size())
@@ -468,7 +443,7 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
: m_data(conditional_aligned_new_auto<T, Align>(size)), m_rows(rows), m_cols(cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl(DenseStorage_impl&& other) noexcept
: m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {
other.m_data = nullptr;
other.m_rows = 0;
@@ -480,11 +455,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
smart_copy(other.m_data, other.m_data + other.size(), m_data);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
EIGEN_DEVICE_FUNC constexpr DenseStorage_impl& operator=(DenseStorage_impl&& other) noexcept {
this->swap(other);
return *this;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void swap(DenseStorage_impl& other) noexcept {
EIGEN_DEVICE_FUNC constexpr void swap(DenseStorage_impl& other) noexcept {
numext::swap(m_data, other.m_data);
numext::swap(m_rows, other.m_rows);
numext::swap(m_cols, other.m_cols);
@@ -504,11 +479,11 @@ class DenseStorage_impl<T, Dynamic, Dynamic, Dynamic, Options> {
m_rows = rows;
m_cols = cols;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return m_data; }
EIGEN_DEVICE_FUNC constexpr Index rows() const { return m_rows; }
EIGEN_DEVICE_FUNC constexpr Index cols() const { return m_cols; }
EIGEN_DEVICE_FUNC constexpr Index size() const { return m_rows * m_cols; }
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
};
template <typename T, int Size, int Rows, int Cols>
struct use_default_move {
@@ -537,15 +512,14 @@ class DenseStorage : public internal::DenseStorage_impl<T, Size, Rows, Cols, Opt
using Base = internal::DenseStorage_impl<T, Size, Rows, Cols, Options>;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(Index size, Index rows, Index cols)
: Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(Index size, Index rows, Index cols) : Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(const DenseStorage&) = default;
// if DenseStorage meets the requirements of use_default_move, then use the move construction and move assignment
// operation defined in DenseStorage_impl, or the compiler-generated version if none is defined
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(DenseStorage&&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(DenseStorage&&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(DenseStorage&&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(DenseStorage&&) = default;
};
template <typename T, int Size, int Rows, int Cols, int Options>
class DenseStorage<T, Size, Rows, Cols, Options, false>
@@ -553,16 +527,15 @@ class DenseStorage<T, Size, Rows, Cols, Options, false>
using Base = internal::DenseStorage_impl<T, Size, Rows, Cols, Options>;
public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(Index size, Index rows, Index cols)
: Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage() = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(const DenseStorage&) = default;
EIGEN_DEVICE_FUNC constexpr DenseStorage(Index size, Index rows, Index cols) : Base(size, rows, cols) {}
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(const DenseStorage&) = default;
// if DenseStorage does not meet the requirements of use_default_move, then defer to the copy construction and copy
// assignment behavior
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage(DenseStorage&& other)
EIGEN_DEVICE_FUNC constexpr DenseStorage(DenseStorage&& other)
: DenseStorage(static_cast<const DenseStorage&>(other)) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr DenseStorage& operator=(DenseStorage&& other) {
EIGEN_DEVICE_FUNC constexpr DenseStorage& operator=(DenseStorage&& other) {
*this = other;
return *this;
}

View File

@@ -87,7 +87,7 @@ template <typename Kernel, typename Device, int Traversal = Kernel::AssignmentTr
int Unrolling = Kernel::AssignmentTraits::Unrolling>
struct dense_assignment_loop_with_device {
using Base = dense_assignment_loop<Kernel, Traversal, Unrolling>;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Kernel& kernel, Device&) { Base::run(kernel); }
static EIGEN_DEVICE_FUNC constexpr void run(Kernel& kernel, Device&) { Base::run(kernel); }
};
// entry point for a generic expression with device

View File

@@ -132,15 +132,11 @@ class Diagonal : public internal::dense_xpr_base<Diagonal<MatrixType, DiagIndex_
private:
// some compilers may fail to optimize std::max etc in case of compile-time constants...
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index absDiagIndex() const noexcept {
EIGEN_DEVICE_FUNC constexpr Index absDiagIndex() const noexcept {
return m_index.value() > 0 ? m_index.value() : -m_index.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rowOffset() const noexcept {
return m_index.value() > 0 ? 0 : -m_index.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index colOffset() const noexcept {
return m_index.value() > 0 ? m_index.value() : 0;
}
EIGEN_DEVICE_FUNC constexpr Index rowOffset() const noexcept { return m_index.value() > 0 ? 0 : -m_index.value(); }
EIGEN_DEVICE_FUNC constexpr Index colOffset() const noexcept { return m_index.value() > 0 ? m_index.value() : 0; }
// trigger a compile-time error if someone try to call packet
template <int LoadMode>
typename MatrixType::PacketReturnType packet(Index) const;

View File

@@ -60,12 +60,12 @@ struct eigen_fill_impl<Xpr, /*use_fill*/ false> {
using Func = scalar_constant_op<Scalar>;
using PlainObject = typename Xpr::PlainObject;
using Constant = typename PlainObject::ConstantReturnType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst, const Scalar& val) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst, const Scalar& val) {
const Constant src(dst.rows(), dst.cols(), val);
run(dst, src);
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst, const SrcXpr& src) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst, const SrcXpr& src) {
call_dense_assignment_loop(dst, src, assign_op<Scalar, Scalar>());
}
};
@@ -104,12 +104,12 @@ struct eigen_zero_impl<Xpr, /*use_memset*/ false> {
using Scalar = typename Xpr::Scalar;
using PlainObject = typename Xpr::PlainObject;
using Zero = typename PlainObject::ZeroReturnType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst) {
const Zero src(dst.rows(), dst.cols());
run(dst, src);
}
template <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void run(Xpr& dst, const SrcXpr& src) {
static EIGEN_DEVICE_FUNC constexpr void run(Xpr& dst, const SrcXpr& src) {
call_dense_assignment_loop(dst, src, assign_op<Scalar, Scalar>());
}
};

View File

@@ -229,7 +229,7 @@ struct gemv_static_vector_if;
template <typename Scalar, int Size, int MaxSize>
struct gemv_static_vector_if<Scalar, Size, MaxSize, false> {
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Scalar* data() {
EIGEN_DEVICE_FUNC constexpr Scalar* data() {
eigen_internal_assert(false && "should never be called");
return 0;
}
@@ -237,19 +237,19 @@ struct gemv_static_vector_if<Scalar, Size, MaxSize, false> {
template <typename Scalar, int Size>
struct gemv_static_vector_if<Scalar, Size, Dynamic, true> {
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Scalar* data() { return 0; }
EIGEN_DEVICE_FUNC constexpr Scalar* data() { return 0; }
};
template <typename Scalar, int Size, int MaxSize>
struct gemv_static_vector_if<Scalar, Size, MaxSize, true> {
#if EIGEN_MAX_STATIC_ALIGN_BYTES != 0
internal::plain_array<Scalar, internal::min_size_prefer_fixed(Size, MaxSize), 0, AlignedMax> m_data;
EIGEN_STRONG_INLINE constexpr Scalar* data() { return m_data.array; }
constexpr Scalar* data() { return m_data.array; }
#else
// Some architectures cannot align on the stack,
// => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
internal::plain_array<Scalar, internal::min_size_prefer_fixed(Size, MaxSize) + EIGEN_MAX_ALIGN_BYTES, 0> m_data;
EIGEN_STRONG_INLINE constexpr Scalar* data() {
constexpr Scalar* data() {
return reinterpret_cast<Scalar*>((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) +
EIGEN_MAX_ALIGN_BYTES);
}

View File

@@ -207,7 +207,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
*
* \callgraph
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(const Matrix& other) { return Base::_set(other); }
EIGEN_DEVICE_FUNC constexpr Matrix& operator=(const Matrix& other) { return Base::_set(other); }
/** \internal
* \brief Copies the value of the expression \a other into \c *this with automatic resizing.
@@ -249,16 +249,16 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
* \sa resize(Index,Index)
*/
#if defined(EIGEN_INITIALIZE_COEFFS)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
EIGEN_DEVICE_FUNC constexpr Matrix() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
#else
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix() = default;
EIGEN_DEVICE_FUNC constexpr Matrix() = default;
#endif
/** \brief Move constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(Matrix&&) = default;
EIGEN_DEVICE_FUNC constexpr Matrix(Matrix&&) = default;
/** \brief Moves the matrix into the other one.
*
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix& operator=(Matrix&& other) noexcept(
EIGEN_DEVICE_FUNC constexpr Matrix& operator=(Matrix&& other) noexcept(
std::is_nothrow_move_assignable<Scalar>::value) {
Base::operator=(std::move(other));
return *this;
@@ -385,7 +385,7 @@ class Matrix : public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, Ma
}
/** \brief Copy constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Matrix(const Matrix&) = default;
EIGEN_DEVICE_FUNC constexpr Matrix(const Matrix&) = default;
/** \brief Copy constructor for generic expressions.
* \sa MatrixBase::operator=(const EigenBase<OtherDerived>&)

View File

@@ -99,12 +99,12 @@ namespace numext {
/** \internal bit-wise cast without changing the underlying bit representation. */
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
template <typename Tgt, typename Src>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
return std::bit_cast<Tgt>(src);
}
#elif EIGEN_HAS_BUILTIN(__builtin_bit_cast)
template <typename Tgt, typename Src>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {
EIGEN_STATIC_ASSERT(std::is_trivially_copyable<Src>::value, THIS_TYPE_IS_NOT_SUPPORTED)
EIGEN_STATIC_ASSERT(std::is_trivially_copyable<Tgt>::value, THIS_TYPE_IS_NOT_SUPPORTED)
EIGEN_STATIC_ASSERT(sizeof(Src) == sizeof(Tgt), THIS_TYPE_IS_NOT_SUPPORTED)

View File

@@ -162,14 +162,14 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
EIGEN_DEVICE_FUNC Base& base() { return *static_cast<Base*>(this); }
EIGEN_DEVICE_FUNC const Base& base() const { return *static_cast<const Base*>(this); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_storage.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_storage.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_storage.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_storage.cols(); }
/** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr const Scalar& coeff(Index rowId, Index colId) const {
if (Flags & RowMajorBit)
return m_storage.data()[colId + rowId * m_storage.cols()];
else // column-major
@@ -180,15 +180,13 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index index) const {
return m_storage.data()[index];
}
EIGEN_DEVICE_FUNC constexpr const Scalar& coeff(Index index) const { return m_storage.data()[index]; }
/** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index rowId, Index colId) {
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index rowId, Index colId) {
if (Flags & RowMajorBit)
return m_storage.data()[colId + rowId * m_storage.cols()];
else // column-major
@@ -199,11 +197,11 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
*
* See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) { return m_storage.data()[index]; }
EIGEN_DEVICE_FUNC constexpr Scalar& coeffRef(Index index) { return m_storage.data()[index]; }
/** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index).
* It is provided for convenience. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index rowId, Index colId) const {
EIGEN_DEVICE_FUNC constexpr const Scalar& coeffRef(Index rowId, Index colId) const {
if (Flags & RowMajorBit)
return m_storage.data()[colId + rowId * m_storage.cols()];
else // column-major
@@ -212,9 +210,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
/** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index).
* It is provided for convenience. */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index index) const {
return m_storage.data()[index];
}
EIGEN_DEVICE_FUNC constexpr const Scalar& coeffRef(Index index) const { return m_storage.data()[index]; }
/** \internal */
template <int LoadMode>
@@ -426,9 +422,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
/** This is a special case of the templated operator=. Its purpose is to
* prevent a default operator= from hiding the templated operator=.
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& operator=(const PlainObjectBase& other) {
return _set(other);
}
EIGEN_DEVICE_FUNC constexpr Derived& operator=(const PlainObjectBase& other) { return _set(other); }
/** \sa MatrixBase::lazyAssign() */
template <typename OtherDerived>
@@ -446,9 +440,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// Prevent user from trying to instantiate PlainObjectBase objects
// by making all its constructor protected. See bug 1074.
protected:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase() = default;
EIGEN_DEVICE_FUNC constexpr PlainObjectBase() = default;
/** \brief Move constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&&) = default;
EIGEN_DEVICE_FUNC constexpr PlainObjectBase(PlainObjectBase&&) = default;
/** \brief Move assignment operator */
EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) noexcept {
m_storage = std::move(other.m_storage);
@@ -456,7 +450,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
}
/** Copy constructor */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase&) = default;
EIGEN_DEVICE_FUNC constexpr PlainObjectBase(const PlainObjectBase&) = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
: m_storage(size, rows, cols) {}
@@ -714,7 +708,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
// aliasing is dealt once in internal::call_assignment
// so at this stage we have to assume aliasing... and resising has to be done later.
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& _set(const DenseBase<OtherDerived>& other) {
internal::call_assignment(this->derived(), other.derived());
return this->derived();
}
@@ -725,7 +719,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
* \sa operator=(const MatrixBase<OtherDerived>&), _set()
*/
template <typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set_noalias(const DenseBase<OtherDerived>& other) {
EIGEN_DEVICE_FUNC constexpr Derived& _set_noalias(const DenseBase<OtherDerived>& other) {
// I don't think we need this resize call since the lazyAssign will anyways resize
// and lazyAssign will be called by the assign selector.
//_resize_to_match(other);

View File

@@ -224,8 +224,8 @@ class Product
"if you wanted a coeff-wise or a dot product use the respective explicit functions");
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_lhs.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_lhs.rows(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const LhsNestedCleaned& lhs() const { return m_lhs; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const RhsNestedCleaned& rhs() const { return m_rhs; }

View File

@@ -65,8 +65,8 @@ class Transpose : public TransposeImpl<MatrixType, typename internal::traits<Mat
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_matrix.rows(); }
/** \returns the nested expression */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all_t<MatrixTypeNested>& nestedExpression() const {
@@ -119,12 +119,8 @@ class TransposeImpl<MatrixType, Dense> : public internal::TransposeImpl_base<Mat
typedef std::conditional_t<internal::is_lvalue<MatrixType>::value, Scalar, const Scalar> ScalarWithConstIfNotLvalue;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr ScalarWithConstIfNotLvalue* data() {
return derived().nestedExpression().data();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar* data() const {
return derived().nestedExpression().data();
}
EIGEN_DEVICE_FUNC constexpr ScalarWithConstIfNotLvalue* data() { return derived().nestedExpression().data(); }
EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return derived().nestedExpression().data(); }
// FIXME: shall we keep the const version of coeffRef?
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const {

View File

@@ -19,7 +19,7 @@ namespace internal {
template <typename RealScalar, int N>
struct complex_packet_wrapper {
using RealPacketT = detail::VectorType<RealScalar, 2 * N>;
EIGEN_STRONG_INLINE complex_packet_wrapper() = default;
complex_packet_wrapper() = default;
EIGEN_STRONG_INLINE explicit complex_packet_wrapper(const RealPacketT& a) : v(a) {}
EIGEN_STRONG_INLINE constexpr std::complex<RealScalar> operator[](Index i) const {
return std::complex<RealScalar>(v[2 * i], v[2 * i + 1]);

View File

@@ -23,7 +23,7 @@ namespace internal {
*/
template <typename DstScalar, typename SrcScalar>
struct assign_op {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void assignCoeff(DstScalar& a, const SrcScalar& b) const { a = b; }
EIGEN_DEVICE_FUNC constexpr void assignCoeff(DstScalar& a, const SrcScalar& b) const { a = b; }
template <int Alignment, typename Packet>
EIGEN_STRONG_INLINE void assignPacket(DstScalar* a, const Packet& b) const {
@@ -56,7 +56,7 @@ struct functor_traits<assign_op<DstScalar, SrcScalar>> {
template <typename DstScalar, typename SrcScalar, typename Func>
struct compound_assign_op {
using traits = functor_traits<compound_assign_op<DstScalar, SrcScalar, Func>>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void assignCoeff(DstScalar& a, const SrcScalar& b) const {
EIGEN_DEVICE_FUNC constexpr void assignCoeff(DstScalar& a, const SrcScalar& b) const {
assign_op<DstScalar, DstScalar>().assignCoeff(a, Func().operator()(a, b));
}

View File

@@ -38,7 +38,7 @@ struct functor_traits<scalar_constant_op<Scalar>> {
template <typename Scalar>
struct scalar_zero_op {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE scalar_zero_op() = default;
EIGEN_DEVICE_FUNC scalar_zero_op() = default;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()() const { return Scalar(0); }
template <typename PacketType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetOp() const {

View File

@@ -1033,7 +1033,7 @@
namespace Eigen {
namespace internal {
template <typename T>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void ignore_unused_variable(const T&) {}
EIGEN_DEVICE_FUNC constexpr void ignore_unused_variable(const T&) {}
} // namespace internal
} // namespace Eigen
#define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);

View File

@@ -116,17 +116,17 @@ class MaxSizeVector {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool empty() const { return size_ == 0; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* data() { return data_; }
EIGEN_DEVICE_FUNC constexpr T* data() { return data_; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* data() const { return data_; }
EIGEN_DEVICE_FUNC constexpr const T* data() const { return data_; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* begin() { return data_; }
EIGEN_DEVICE_FUNC constexpr T* begin() { return data_; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr T* end() { return data_ + size_; }
EIGEN_DEVICE_FUNC constexpr T* end() { return data_ + size_; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* begin() const { return data_; }
EIGEN_DEVICE_FUNC constexpr const T* begin() const { return data_; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const T* end() const { return data_ + size_; }
EIGEN_DEVICE_FUNC constexpr const T* end() const { return data_ + size_; }
private:
size_t reserve_;

View File

@@ -1355,15 +1355,13 @@ EIGEN_DEVICE_FUNC void destroy_at(T* p) {
#endif
// FIXME(rmlarsen): Work around missing linker symbol with msan on ARM.
#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && __has_feature(memory_sanitizer) && \
(EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64)
#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && __has_feature(memory_sanitizer) && (EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64)
#define EIGEN_DONT_ASSUME_ALIGNED
#endif
#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && defined(__cpp_lib_assume_aligned) && (__cpp_lib_assume_aligned >= 201811L)
template <std::size_t N, typename T>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) {
EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) {
return std::assume_aligned<N, T>(ptr);
}
#elif !defined(EIGEN_DONT_ASSUME_ALIGNED) && EIGEN_HAS_BUILTIN(__builtin_assume_aligned)
@@ -1373,7 +1371,7 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC T* assume_aligned(T* ptr) {
}
#else
template <std::size_t N, typename T>
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) {
EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) {
return ptr;
}
#endif

View File

@@ -186,12 +186,11 @@ struct h_skip_helper_type<0> {
template <int n>
struct h_skip {
template <typename T, T... ii>
constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_numeric<T, n, ii...>::type helper(
numeric_list<T, ii...>) {
constexpr static typename h_skip_helper_numeric<T, n, ii...>::type helper(numeric_list<T, ii...>) {
return typename h_skip_helper_numeric<T, n, ii...>::type();
}
template <typename... tt>
constexpr static EIGEN_STRONG_INLINE typename h_skip_helper_type<n, tt...>::type helper(type_list<tt...>) {
constexpr static typename h_skip_helper_type<n, tt...>::type helper(type_list<tt...>) {
return typename h_skip_helper_type<n, tt...>::type();
}
};
@@ -330,17 +329,17 @@ struct reduce;
template <typename Reducer>
struct reduce<Reducer> {
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE int run() { return Reducer::Identity; }
EIGEN_DEVICE_FUNC constexpr static int run() { return Reducer::Identity; }
};
template <typename Reducer, typename A>
struct reduce<Reducer, A> {
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE A run(A a) { return a; }
EIGEN_DEVICE_FUNC constexpr static A run(A a) { return a; }
};
template <typename Reducer, typename A, typename... Ts>
struct reduce<Reducer, A, Ts...> {
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, Ts... ts)
EIGEN_DEVICE_FUNC constexpr static auto run(A a, Ts... ts)
-> decltype(Reducer::run(a, reduce<Reducer, Ts...>::run(ts...))) {
return Reducer::run(a, reduce<Reducer, Ts...>::run(ts...));
}
@@ -350,14 +349,14 @@ struct reduce<Reducer, A, Ts...> {
struct sum_op {
template <typename A, typename B>
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a + b) {
EIGEN_DEVICE_FUNC constexpr static auto run(A a, B b) -> decltype(a + b) {
return a + b;
}
static constexpr int Identity = 0;
};
struct product_op {
template <typename A, typename B>
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a * b) {
EIGEN_DEVICE_FUNC constexpr static auto run(A a, B b) -> decltype(a * b) {
return a * b;
}
static constexpr int Identity = 1;
@@ -365,50 +364,50 @@ struct product_op {
struct logical_and_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a && b) {
constexpr static auto run(A a, B b) -> decltype(a && b) {
return a && b;
}
};
struct logical_or_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a || b) {
constexpr static auto run(A a, B b) -> decltype(a || b) {
return a || b;
}
};
struct equal_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a == b) {
constexpr static auto run(A a, B b) -> decltype(a == b) {
return a == b;
}
};
struct not_equal_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a != b) {
constexpr static auto run(A a, B b) -> decltype(a != b) {
return a != b;
}
};
struct lesser_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a < b) {
constexpr static auto run(A a, B b) -> decltype(a < b) {
return a < b;
}
};
struct lesser_equal_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a <= b) {
constexpr static auto run(A a, B b) -> decltype(a <= b) {
return a <= b;
}
};
struct greater_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a > b) {
constexpr static auto run(A a, B b) -> decltype(a > b) {
return a > b;
}
};
struct greater_equal_op {
template <typename A, typename B>
constexpr static EIGEN_STRONG_INLINE auto run(A a, B b) -> decltype(a >= b) {
constexpr static auto run(A a, B b) -> decltype(a >= b) {
return a >= b;
}
};
@@ -417,19 +416,19 @@ struct greater_equal_op {
struct not_op {
template <typename A>
constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(!a) {
constexpr static auto run(A a) -> decltype(!a) {
return !a;
}
};
struct negation_op {
template <typename A>
constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(-a) {
constexpr static auto run(A a) -> decltype(-a) {
return -a;
}
};
struct greater_equal_zero_op {
template <typename A>
constexpr static EIGEN_STRONG_INLINE auto run(A a) -> decltype(a >= 0) {
constexpr static auto run(A a) -> decltype(a >= 0) {
return a >= 0;
}
};
@@ -440,25 +439,24 @@ struct greater_equal_zero_op {
// together in front... (13.0 doesn't work with array_prod/array_reduce/... anyway, but 13.1
// does...
template <typename... Ts>
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE decltype(reduce<product_op, Ts...>::run((*((Ts*)0))...)) arg_prod(
Ts... ts) {
EIGEN_DEVICE_FUNC constexpr decltype(reduce<product_op, Ts...>::run((*((Ts*)0))...)) arg_prod(Ts... ts) {
return reduce<product_op, Ts...>::run(ts...);
}
template <typename... Ts>
constexpr EIGEN_STRONG_INLINE decltype(reduce<sum_op, Ts...>::run((*((Ts*)0))...)) arg_sum(Ts... ts) {
constexpr decltype(reduce<sum_op, Ts...>::run((*((Ts*)0))...)) arg_sum(Ts... ts) {
return reduce<sum_op, Ts...>::run(ts...);
}
/* reverse arrays */
template <typename Array, int... n>
constexpr EIGEN_STRONG_INLINE Array h_array_reverse(Array arr, numeric_list<int, n...>) {
constexpr Array h_array_reverse(Array arr, numeric_list<int, n...>) {
return {{array_get<sizeof...(n) - n - 1>(arr)...}};
}
template <typename T, std::size_t N>
constexpr EIGEN_STRONG_INLINE array<T, N> array_reverse(array<T, N> arr) {
constexpr array<T, N> array_reverse(array<T, N> arr) {
return h_array_reverse(arr, typename gen_numeric_list<int, N>::type());
}
@@ -471,7 +469,7 @@ constexpr EIGEN_STRONG_INLINE array<T, N> array_reverse(array<T, N> arr) {
// an infinite loop)
template <typename Reducer, typename T, std::size_t N, std::size_t n = N - 1>
struct h_array_reduce {
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE auto run(array<T, N> arr, T identity)
EIGEN_DEVICE_FUNC constexpr static auto run(array<T, N> arr, T identity)
-> decltype(Reducer::run(h_array_reduce<Reducer, T, N, n - 1>::run(arr, identity), array_get<n>(arr))) {
return Reducer::run(h_array_reduce<Reducer, T, N, n - 1>::run(arr, identity), array_get<n>(arr));
}
@@ -479,16 +477,16 @@ struct h_array_reduce {
template <typename Reducer, typename T, std::size_t N>
struct h_array_reduce<Reducer, T, N, 0> {
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE T run(const array<T, N>& arr, T) { return array_get<0>(arr); }
EIGEN_DEVICE_FUNC constexpr static T run(const array<T, N>& arr, T) { return array_get<0>(arr); }
};
template <typename Reducer, typename T>
struct h_array_reduce<Reducer, T, 0> {
EIGEN_DEVICE_FUNC constexpr static EIGEN_STRONG_INLINE T run(const array<T, 0>&, T identity) { return identity; }
EIGEN_DEVICE_FUNC constexpr static T run(const array<T, 0>&, T identity) { return identity; }
};
template <typename Reducer, typename T, std::size_t N>
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_reduce(const array<T, N>& arr, T identity)
EIGEN_DEVICE_FUNC constexpr auto array_reduce(const array<T, N>& arr, T identity)
-> decltype(h_array_reduce<Reducer, T, N>::run(arr, identity)) {
return h_array_reduce<Reducer, T, N>::run(arr, identity);
}
@@ -496,13 +494,13 @@ EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_reduce(const array<T,
/* standard array reductions */
template <typename T, std::size_t N>
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_sum(const array<T, N>& arr)
EIGEN_DEVICE_FUNC constexpr auto array_sum(const array<T, N>& arr)
-> decltype(array_reduce<sum_op, T, N>(arr, static_cast<T>(0))) {
return array_reduce<sum_op, T, N>(arr, static_cast<T>(0));
}
template <typename T, std::size_t N>
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE auto array_prod(const array<T, N>& arr)
EIGEN_DEVICE_FUNC constexpr auto array_prod(const array<T, N>& arr)
-> decltype(array_reduce<product_op, T, N>(arr, static_cast<T>(1))) {
return array_reduce<product_op, T, N>(arr, static_cast<T>(1));
}
@@ -520,20 +518,19 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const std::vector<t>& a) {
/* zip an array */
template <typename Op, typename A, typename B, std::size_t N, int... n>
constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A(), B())), N> h_array_zip(array<A, N> a, array<B, N> b,
numeric_list<int, n...>) {
constexpr array<decltype(Op::run(A(), B())), N> h_array_zip(array<A, N> a, array<B, N> b, numeric_list<int, n...>) {
return array<decltype(Op::run(A(), B())), N>{{Op::run(array_get<n>(a), array_get<n>(b))...}};
}
template <typename Op, typename A, typename B, std::size_t N>
constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A(), B())), N> array_zip(array<A, N> a, array<B, N> b) {
constexpr array<decltype(Op::run(A(), B())), N> array_zip(array<A, N> a, array<B, N> b) {
return h_array_zip<Op>(a, b, typename gen_numeric_list<int, N>::type());
}
/* zip an array and reduce the result */
template <typename Reducer, typename Op, typename A, typename B, std::size_t N, int... n>
constexpr EIGEN_STRONG_INLINE auto h_array_zip_and_reduce(array<A, N> a, array<B, N> b, numeric_list<int, n...>)
constexpr auto h_array_zip_and_reduce(array<A, N> a, array<B, N> b, numeric_list<int, n...>)
-> decltype(reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A(), B()))>::type...>::run(
Op::run(array_get<n>(a), array_get<n>(b))...)) {
return reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A(), B()))>::type...>::run(
@@ -541,7 +538,7 @@ constexpr EIGEN_STRONG_INLINE auto h_array_zip_and_reduce(array<A, N> a, array<B
}
template <typename Reducer, typename Op, typename A, typename B, std::size_t N>
constexpr EIGEN_STRONG_INLINE auto array_zip_and_reduce(array<A, N> a, array<B, N> b)
constexpr auto array_zip_and_reduce(array<A, N> a, array<B, N> b)
-> decltype(h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type())) {
return h_array_zip_and_reduce<Reducer, Op, A, B, N>(a, b, typename gen_numeric_list<int, N>::type());
}
@@ -549,19 +546,19 @@ constexpr EIGEN_STRONG_INLINE auto array_zip_and_reduce(array<A, N> a, array<B,
/* apply stuff to an array */
template <typename Op, typename A, std::size_t N, int... n>
constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A())), N> h_array_apply(array<A, N> a, numeric_list<int, n...>) {
constexpr array<decltype(Op::run(A())), N> h_array_apply(array<A, N> a, numeric_list<int, n...>) {
return array<decltype(Op::run(A())), N>{{Op::run(array_get<n>(a))...}};
}
template <typename Op, typename A, std::size_t N>
constexpr EIGEN_STRONG_INLINE array<decltype(Op::run(A())), N> array_apply(array<A, N> a) {
constexpr array<decltype(Op::run(A())), N> array_apply(array<A, N> a) {
return h_array_apply<Op>(a, typename gen_numeric_list<int, N>::type());
}
/* apply stuff to an array and reduce */
template <typename Reducer, typename Op, typename A, std::size_t N, int... n>
constexpr EIGEN_STRONG_INLINE auto h_array_apply_and_reduce(array<A, N> arr, numeric_list<int, n...>)
constexpr auto h_array_apply_and_reduce(array<A, N> arr, numeric_list<int, n...>)
-> decltype(reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A()))>::type...>::run(
Op::run(array_get<n>(arr))...)) {
return reduce<Reducer, typename id_numeric<int, n, decltype(Op::run(A()))>::type...>::run(
@@ -569,7 +566,7 @@ constexpr EIGEN_STRONG_INLINE auto h_array_apply_and_reduce(array<A, N> arr, num
}
template <typename Reducer, typename Op, typename A, std::size_t N>
constexpr EIGEN_STRONG_INLINE auto array_apply_and_reduce(array<A, N> a)
constexpr auto array_apply_and_reduce(array<A, N> a)
-> decltype(h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type())) {
return h_array_apply_and_reduce<Reducer, Op, A, N>(a, typename gen_numeric_list<int, N>::type());
}
@@ -582,7 +579,7 @@ constexpr EIGEN_STRONG_INLINE auto array_apply_and_reduce(array<A, N> a)
template <int n>
struct h_repeat {
template <typename t, int... ii>
constexpr static EIGEN_STRONG_INLINE array<t, n> run(t v, numeric_list<int, ii...>) {
constexpr static array<t, n> run(t v, numeric_list<int, ii...>) {
return {{typename id_numeric<int, ii, t>::type(v)...}};
}
};

View File

@@ -156,8 +156,8 @@ class variable_if_dynamic {
EIGEN_ONLY_USED_FOR_DEBUG(v);
eigen_assert(v == T(Value));
}
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE constexpr T value() { return T(Value); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr operator T() const { return T(Value); }
EIGEN_DEVICE_FUNC static constexpr T value() { return T(Value); }
EIGEN_DEVICE_FUNC constexpr operator T() const { return T(Value); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T v) const {
EIGEN_ONLY_USED_FOR_DEBUG(v);
eigen_assert(v == T(Value));
@@ -184,7 +184,7 @@ class variable_if_dynamicindex {
EIGEN_ONLY_USED_FOR_DEBUG(v);
eigen_assert(v == T(Value));
}
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE constexpr T value() { return T(Value); }
EIGEN_DEVICE_FUNC static constexpr T value() { return T(Value); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T) {}
};