mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 00:29:38 +08:00
Format EIGEN_STATIC_ASSERT() as a statement macro
This commit is contained in:
parent
f78dfe36b0
commit
d165c7377f
@ -2,6 +2,8 @@
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
ColumnLimit: 120
|
||||
StatementMacros:
|
||||
- EIGEN_STATIC_ASSERT
|
||||
SortIncludes: false
|
||||
AttributeMacros:
|
||||
- EIGEN_STRONG_INLINE
|
||||
|
@ -167,7 +167,7 @@ class plainobjectbase_evaluator_data<Scalar, Dynamic> {
|
||||
};
|
||||
|
||||
template <typename Derived>
|
||||
struct evaluator<PlainObjectBase<Derived> > : evaluator_base<Derived> {
|
||||
struct evaluator<PlainObjectBase<Derived>> : evaluator_base<Derived> {
|
||||
typedef PlainObjectBase<Derived> PlainObjectType;
|
||||
typedef typename PlainObjectType::Scalar Scalar;
|
||||
typedef typename PlainObjectType::CoeffReturnType CoeffReturnType;
|
||||
@ -247,31 +247,29 @@ struct evaluator<PlainObjectBase<Derived> > : evaluator_base<Derived> {
|
||||
};
|
||||
|
||||
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
|
||||
struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
|
||||
: evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > > {
|
||||
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 evaluator() {}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m)
|
||||
: evaluator<PlainObjectBase<XprType> >(m) {}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType>>(m) {}
|
||||
};
|
||||
|
||||
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
|
||||
struct evaluator<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
|
||||
: evaluator<PlainObjectBase<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > > {
|
||||
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 evaluator() {}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m)
|
||||
: evaluator<PlainObjectBase<XprType> >(m) {}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m) : evaluator<PlainObjectBase<XprType>>(m) {}
|
||||
};
|
||||
|
||||
// -------------------- Transpose --------------------
|
||||
|
||||
template <typename ArgType>
|
||||
struct unary_evaluator<Transpose<ArgType>, IndexBased> : evaluator_base<Transpose<ArgType> > {
|
||||
struct unary_evaluator<Transpose<ArgType>, IndexBased> : evaluator_base<Transpose<ArgType>> {
|
||||
typedef Transpose<ArgType> XprType;
|
||||
|
||||
enum {
|
||||
@ -460,8 +458,8 @@ struct nullary_wrapper<Scalar,NullaryOp,true,true,true>
|
||||
#endif // MSVC workaround
|
||||
|
||||
template <typename NullaryOp, typename PlainObjectType>
|
||||
struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType> >
|
||||
: evaluator_base<CwiseNullaryOp<NullaryOp, PlainObjectType> > {
|
||||
struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType>>
|
||||
: evaluator_base<CwiseNullaryOp<NullaryOp, PlainObjectType>> {
|
||||
typedef CwiseNullaryOp<NullaryOp, PlainObjectType> XprType;
|
||||
typedef internal::remove_all_t<PlainObjectType> PlainObjectTypeCleaned;
|
||||
|
||||
@ -509,7 +507,7 @@ struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType> >
|
||||
// -------------------- CwiseUnaryOp --------------------
|
||||
|
||||
template <typename UnaryOp, typename ArgType>
|
||||
struct unary_evaluator<CwiseUnaryOp<UnaryOp, ArgType>, IndexBased> : evaluator_base<CwiseUnaryOp<UnaryOp, ArgType> > {
|
||||
struct unary_evaluator<CwiseUnaryOp<UnaryOp, ArgType>, IndexBased> : evaluator_base<CwiseUnaryOp<UnaryOp, ArgType>> {
|
||||
typedef CwiseUnaryOp<UnaryOp, ArgType> XprType;
|
||||
|
||||
enum {
|
||||
@ -762,17 +760,17 @@ struct unary_evaluator<CwiseUnaryOp<core_cast_op<SrcType, DstType>, ArgType>, In
|
||||
|
||||
// this is a ternary expression
|
||||
template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
|
||||
struct evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> >
|
||||
: public ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > {
|
||||
struct evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>>
|
||||
: public ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> {
|
||||
typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType;
|
||||
typedef ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > Base;
|
||||
typedef ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> Base;
|
||||
|
||||
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {}
|
||||
};
|
||||
|
||||
template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
|
||||
struct ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>, IndexBased, IndexBased>
|
||||
: evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > {
|
||||
: evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> {
|
||||
typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType;
|
||||
|
||||
enum {
|
||||
@ -865,16 +863,16 @@ struct evaluator<CwiseTernaryOp<scalar_boolean_select_op<Scalar, Scalar, bool>,
|
||||
|
||||
// this is a binary expression
|
||||
template <typename BinaryOp, typename Lhs, typename Rhs>
|
||||
struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > : public binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > {
|
||||
struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> : public binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
|
||||
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
|
||||
typedef binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > Base;
|
||||
typedef binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> Base;
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {}
|
||||
};
|
||||
|
||||
template <typename BinaryOp, typename Lhs, typename Rhs>
|
||||
struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IndexBased, IndexBased>
|
||||
: evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > {
|
||||
: evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
|
||||
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
|
||||
|
||||
enum {
|
||||
@ -939,7 +937,7 @@ struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IndexBased, IndexBase
|
||||
|
||||
template <typename UnaryOp, typename ArgType, typename StrideType>
|
||||
struct unary_evaluator<CwiseUnaryView<UnaryOp, ArgType, StrideType>, IndexBased>
|
||||
: evaluator_base<CwiseUnaryView<UnaryOp, ArgType, StrideType> > {
|
||||
: evaluator_base<CwiseUnaryView<UnaryOp, ArgType, StrideType>> {
|
||||
typedef CwiseUnaryView<UnaryOp, ArgType, StrideType> XprType;
|
||||
|
||||
enum {
|
||||
@ -1067,7 +1065,7 @@ struct mapbase_evaluator : evaluator_base<Derived> {
|
||||
};
|
||||
|
||||
template <typename PlainObjectType, int MapOptions, typename StrideType>
|
||||
struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
|
||||
struct evaluator<Map<PlainObjectType, MapOptions, StrideType>>
|
||||
: public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType> {
|
||||
typedef Map<PlainObjectType, MapOptions, StrideType> XprType;
|
||||
typedef typename XprType::Scalar Scalar;
|
||||
@ -1100,13 +1098,13 @@ struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
|
||||
// -------------------- Ref --------------------
|
||||
|
||||
template <typename PlainObjectType, int RefOptions, typename StrideType>
|
||||
struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> >
|
||||
struct evaluator<Ref<PlainObjectType, RefOptions, StrideType>>
|
||||
: public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType> {
|
||||
typedef Ref<PlainObjectType, RefOptions, StrideType> XprType;
|
||||
|
||||
enum {
|
||||
Flags = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Flags,
|
||||
Alignment = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Alignment
|
||||
Flags = evaluator<Map<PlainObjectType, RefOptions, StrideType>>::Flags,
|
||||
Alignment = evaluator<Map<PlainObjectType, RefOptions, StrideType>>::Alignment
|
||||
};
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& ref)
|
||||
@ -1120,7 +1118,7 @@ template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel,
|
||||
struct block_evaluator;
|
||||
|
||||
template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
|
||||
struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
|
||||
struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>>
|
||||
: block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel> {
|
||||
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
|
||||
typedef typename XprType::Scalar Scalar;
|
||||
@ -1171,7 +1169,7 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
|
||||
// no direct-access => dispatch to a unary evaluator
|
||||
template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
|
||||
struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /*HasDirectAccess*/ false>
|
||||
: unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> > {
|
||||
: unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>> {
|
||||
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit block_evaluator(const XprType& block)
|
||||
@ -1180,7 +1178,7 @@ struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /*HasDirectAcc
|
||||
|
||||
template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
|
||||
struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBased>
|
||||
: evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel> > {
|
||||
: evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel>> {
|
||||
typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& block)
|
||||
@ -1293,8 +1291,8 @@ struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAc
|
||||
|
||||
// TODO enable vectorization for Select
|
||||
template <typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
|
||||
struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
||||
: evaluator_base<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> > {
|
||||
struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType>>
|
||||
: evaluator_base<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType>> {
|
||||
typedef Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> XprType;
|
||||
enum {
|
||||
CoeffReadCost = evaluator<ConditionMatrixType>::CoeffReadCost +
|
||||
@ -1335,8 +1333,8 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
||||
// -------------------- Replicate --------------------
|
||||
|
||||
template <typename ArgType, int RowFactor, int ColFactor>
|
||||
struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
|
||||
: evaluator_base<Replicate<ArgType, RowFactor, ColFactor> > {
|
||||
struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor>>
|
||||
: evaluator_base<Replicate<ArgType, RowFactor, ColFactor>> {
|
||||
typedef Replicate<ArgType, RowFactor, ColFactor> XprType;
|
||||
typedef typename XprType::CoeffReturnType CoeffReturnType;
|
||||
enum { Factor = (RowFactor == Dynamic || ColFactor == Dynamic) ? Dynamic : RowFactor * ColFactor };
|
||||
@ -1461,19 +1459,19 @@ struct evaluator_wrapper_base : evaluator_base<XprType> {
|
||||
};
|
||||
|
||||
template <typename TArgType>
|
||||
struct unary_evaluator<MatrixWrapper<TArgType> > : evaluator_wrapper_base<MatrixWrapper<TArgType> > {
|
||||
struct unary_evaluator<MatrixWrapper<TArgType>> : evaluator_wrapper_base<MatrixWrapper<TArgType>> {
|
||||
typedef MatrixWrapper<TArgType> XprType;
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& wrapper)
|
||||
: evaluator_wrapper_base<MatrixWrapper<TArgType> >(wrapper.nestedExpression()) {}
|
||||
: evaluator_wrapper_base<MatrixWrapper<TArgType>>(wrapper.nestedExpression()) {}
|
||||
};
|
||||
|
||||
template <typename TArgType>
|
||||
struct unary_evaluator<ArrayWrapper<TArgType> > : evaluator_wrapper_base<ArrayWrapper<TArgType> > {
|
||||
struct unary_evaluator<ArrayWrapper<TArgType>> : evaluator_wrapper_base<ArrayWrapper<TArgType>> {
|
||||
typedef ArrayWrapper<TArgType> XprType;
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& wrapper)
|
||||
: evaluator_wrapper_base<ArrayWrapper<TArgType> >(wrapper.nestedExpression()) {}
|
||||
: evaluator_wrapper_base<ArrayWrapper<TArgType>>(wrapper.nestedExpression()) {}
|
||||
};
|
||||
|
||||
// -------------------- Reverse --------------------
|
||||
@ -1483,7 +1481,7 @@ template <typename PacketType, bool ReversePacket>
|
||||
struct reverse_packet_cond;
|
||||
|
||||
template <typename ArgType, int Direction>
|
||||
struct unary_evaluator<Reverse<ArgType, Direction> > : evaluator_base<Reverse<ArgType, Direction> > {
|
||||
struct unary_evaluator<Reverse<ArgType, Direction>> : evaluator_base<Reverse<ArgType, Direction>> {
|
||||
typedef Reverse<ArgType, Direction> XprType;
|
||||
typedef typename XprType::Scalar Scalar;
|
||||
typedef typename XprType::CoeffReturnType CoeffReturnType;
|
||||
@ -1584,7 +1582,7 @@ struct unary_evaluator<Reverse<ArgType, Direction> > : evaluator_base<Reverse<Ar
|
||||
// -------------------- Diagonal --------------------
|
||||
|
||||
template <typename ArgType, int DiagIndex>
|
||||
struct evaluator<Diagonal<ArgType, DiagIndex> > : evaluator_base<Diagonal<ArgType, DiagIndex> > {
|
||||
struct evaluator<Diagonal<ArgType, DiagIndex>> : evaluator_base<Diagonal<ArgType, DiagIndex>> {
|
||||
typedef Diagonal<ArgType, DiagIndex> XprType;
|
||||
|
||||
enum {
|
||||
@ -1643,10 +1641,10 @@ template <typename ArgType>
|
||||
class EvalToTemp;
|
||||
|
||||
template <typename ArgType>
|
||||
struct traits<EvalToTemp<ArgType> > : public traits<ArgType> {};
|
||||
struct traits<EvalToTemp<ArgType>> : public traits<ArgType> {};
|
||||
|
||||
template <typename ArgType>
|
||||
class EvalToTemp : public dense_xpr_base<EvalToTemp<ArgType> >::type {
|
||||
class EvalToTemp : public dense_xpr_base<EvalToTemp<ArgType>>::type {
|
||||
public:
|
||||
typedef typename dense_xpr_base<EvalToTemp>::type Base;
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp)
|
||||
@ -1664,7 +1662,7 @@ class EvalToTemp : public dense_xpr_base<EvalToTemp<ArgType> >::type {
|
||||
};
|
||||
|
||||
template <typename ArgType>
|
||||
struct evaluator<EvalToTemp<ArgType> > : public evaluator<typename ArgType::PlainObject> {
|
||||
struct evaluator<EvalToTemp<ArgType>> : public evaluator<typename ArgType::PlainObject> {
|
||||
typedef EvalToTemp<ArgType> XprType;
|
||||
typedef typename ArgType::PlainObject PlainObject;
|
||||
typedef evaluator<PlainObject> Base;
|
||||
|
@ -243,17 +243,15 @@ struct gemv_static_vector_if<Scalar, Size, Dynamic, true> {
|
||||
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;
|
||||
internal::plain_array<Scalar, internal::min_size_prefer_fixed(Size, MaxSize), 0, AlignedMax> m_data;
|
||||
EIGEN_STRONG_INLINE 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;
|
||||
internal::plain_array<Scalar, internal::min_size_prefer_fixed(Size, MaxSize) + EIGEN_MAX_ALIGN_BYTES, 0> m_data;
|
||||
EIGEN_STRONG_INLINE Scalar* data() {
|
||||
return reinterpret_cast<Scalar*>((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) + EIGEN_MAX_ALIGN_BYTES);
|
||||
return reinterpret_cast<Scalar*>((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) +
|
||||
EIGEN_MAX_ALIGN_BYTES);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
@ -80,15 +80,12 @@ class Replicate : public internal::dense_xpr_base<Replicate<MatrixType, RowFacto
|
||||
|
||||
template <typename OriginalMatrixType>
|
||||
EIGEN_DEVICE_FUNC inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
|
||||
: m_matrix(matrix),
|
||||
m_rowFactor(rowFactor),
|
||||
m_colFactor(colFactor){
|
||||
EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value),
|
||||
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const {
|
||||
return m_matrix.rows() * m_rowFactor.value();
|
||||
: m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) {
|
||||
EIGEN_STATIC_ASSERT((internal::is_same<std::remove_const_t<MatrixType>, OriginalMatrixType>::value),
|
||||
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); }
|
||||
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); }
|
||||
|
||||
EIGEN_DEVICE_FUNC const MatrixTypeNested_& nestedExpression() const { return m_matrix; }
|
||||
|
@ -57,7 +57,7 @@ EIGEN_STRONG_INLINE void trsmKernelL<Scalar, Index, Mode, Conjugate, TriStorageO
|
||||
Index rs = size - k - 1; // remaining size
|
||||
Index s = TriStorageOrder == RowMajor ? (IsLower ? 0 : i + 1) : IsLower ? i + 1 : i - rs;
|
||||
|
||||
Scalar a = (Mode & UnitDiag) ? Scalar(1) : Scalar(Scalar(1)/conj(tri(i,i)));
|
||||
Scalar a = (Mode & UnitDiag) ? Scalar(1) : Scalar(Scalar(1) / conj(tri(i, i)));
|
||||
for (Index j = 0; j < otherSize; ++j) {
|
||||
if (TriStorageOrder == RowMajor) {
|
||||
Scalar b(0);
|
||||
|
@ -96,17 +96,17 @@ class BaseExpr {
|
||||
return AddExpr<Derived, ValueExpr<>>(derived(), -a);
|
||||
}
|
||||
constexpr ProductExpr<Derived, ValueExpr<>> operator*(Index a) const {
|
||||
return ProductExpr<Derived, ValueExpr<> >(derived(), a);
|
||||
return ProductExpr<Derived, ValueExpr<>>(derived(), a);
|
||||
}
|
||||
constexpr QuotientExpr<Derived, ValueExpr<>> operator/(Index a) const {
|
||||
return QuotientExpr<Derived, ValueExpr<> >(derived(), a);
|
||||
return QuotientExpr<Derived, ValueExpr<>>(derived(), a);
|
||||
}
|
||||
|
||||
friend constexpr AddExpr<Derived, ValueExpr<>> operator+(Index a, const BaseExpr& b) {
|
||||
return AddExpr<Derived, ValueExpr<> >(b.derived(), a);
|
||||
return AddExpr<Derived, ValueExpr<>>(b.derived(), a);
|
||||
}
|
||||
friend constexpr AddExpr<NegateExpr<Derived>, ValueExpr<>> operator-(Index a, const BaseExpr& b) {
|
||||
return AddExpr<NegateExpr<Derived>, ValueExpr<> >(-b.derived(), a);
|
||||
return AddExpr<NegateExpr<Derived>, ValueExpr<>>(-b.derived(), a);
|
||||
}
|
||||
friend constexpr ProductExpr<ValueExpr<>, Derived> operator*(Index a, const BaseExpr& b) {
|
||||
return ProductExpr<ValueExpr<>, Derived>(a, b.derived());
|
||||
@ -117,41 +117,41 @@ class BaseExpr {
|
||||
|
||||
template <int N>
|
||||
constexpr AddExpr<Derived, ValueExpr<internal::FixedInt<N>>> operator+(internal::FixedInt<N>) const {
|
||||
return AddExpr<Derived, ValueExpr<internal::FixedInt<N> > >(derived(), ValueExpr<internal::FixedInt<N> >());
|
||||
return AddExpr<Derived, ValueExpr<internal::FixedInt<N>>>(derived(), ValueExpr<internal::FixedInt<N>>());
|
||||
}
|
||||
template <int N>
|
||||
constexpr AddExpr<Derived, ValueExpr<internal::FixedInt<-N>>> operator-(internal::FixedInt<N>) const {
|
||||
return AddExpr<Derived, ValueExpr<internal::FixedInt<-N> > >(derived(), ValueExpr<internal::FixedInt<-N> >());
|
||||
return AddExpr<Derived, ValueExpr<internal::FixedInt<-N>>>(derived(), ValueExpr<internal::FixedInt<-N>>());
|
||||
}
|
||||
template <int N>
|
||||
constexpr ProductExpr<Derived, ValueExpr<internal::FixedInt<N>>> operator*(internal::FixedInt<N>) const {
|
||||
return ProductExpr<Derived, ValueExpr<internal::FixedInt<N> > >(derived(), ValueExpr<internal::FixedInt<N> >());
|
||||
return ProductExpr<Derived, ValueExpr<internal::FixedInt<N>>>(derived(), ValueExpr<internal::FixedInt<N>>());
|
||||
}
|
||||
template <int N>
|
||||
constexpr QuotientExpr<Derived, ValueExpr<internal::FixedInt<N>>> operator/(internal::FixedInt<N>) const {
|
||||
return QuotientExpr<Derived, ValueExpr<internal::FixedInt<N> > >(derived(), ValueExpr<internal::FixedInt<N> >());
|
||||
return QuotientExpr<Derived, ValueExpr<internal::FixedInt<N>>>(derived(), ValueExpr<internal::FixedInt<N>>());
|
||||
}
|
||||
|
||||
template <int N>
|
||||
friend constexpr AddExpr<Derived, ValueExpr<internal::FixedInt<N>>> operator+(internal::FixedInt<N>,
|
||||
const BaseExpr& b) {
|
||||
return AddExpr<Derived, ValueExpr<internal::FixedInt<N> > >(b.derived(), ValueExpr<internal::FixedInt<N> >());
|
||||
return AddExpr<Derived, ValueExpr<internal::FixedInt<N>>>(b.derived(), ValueExpr<internal::FixedInt<N>>());
|
||||
}
|
||||
template <int N>
|
||||
friend constexpr AddExpr<NegateExpr<Derived>, ValueExpr<internal::FixedInt<N>>> operator-(internal::FixedInt<N>,
|
||||
const BaseExpr& b) {
|
||||
return AddExpr<NegateExpr<Derived>, ValueExpr<internal::FixedInt<N> > >(-b.derived(),
|
||||
ValueExpr<internal::FixedInt<N> >());
|
||||
return AddExpr<NegateExpr<Derived>, ValueExpr<internal::FixedInt<N>>>(-b.derived(),
|
||||
ValueExpr<internal::FixedInt<N>>());
|
||||
}
|
||||
template <int N>
|
||||
friend constexpr ProductExpr<ValueExpr<internal::FixedInt<N>>, Derived> operator*(internal::FixedInt<N>,
|
||||
const BaseExpr& b) {
|
||||
return ProductExpr<ValueExpr<internal::FixedInt<N> >, Derived>(ValueExpr<internal::FixedInt<N> >(), b.derived());
|
||||
return ProductExpr<ValueExpr<internal::FixedInt<N>>, Derived>(ValueExpr<internal::FixedInt<N>>(), b.derived());
|
||||
}
|
||||
template <int N>
|
||||
friend constexpr QuotientExpr<ValueExpr<internal::FixedInt<N>>, Derived> operator/(internal::FixedInt<N>,
|
||||
const BaseExpr& b) {
|
||||
return QuotientExpr<ValueExpr<internal::FixedInt<N> >, Derived>(ValueExpr<internal::FixedInt<N> >(), b.derived());
|
||||
return QuotientExpr<ValueExpr<internal::FixedInt<N>>, Derived>(ValueExpr<internal::FixedInt<N>>(), b.derived());
|
||||
}
|
||||
|
||||
template <typename OtherDerived>
|
||||
@ -161,7 +161,7 @@ class BaseExpr {
|
||||
|
||||
template <typename OtherDerived>
|
||||
constexpr AddExpr<Derived, NegateExpr<OtherDerived>> operator-(const BaseExpr<OtherDerived>& b) const {
|
||||
return AddExpr<Derived, NegateExpr<OtherDerived> >(derived(), -b.derived());
|
||||
return AddExpr<Derived, NegateExpr<OtherDerived>>(derived(), -b.derived());
|
||||
}
|
||||
|
||||
template <typename OtherDerived>
|
||||
@ -179,7 +179,7 @@ template <typename T>
|
||||
struct is_symbolic {
|
||||
// BaseExpr has no conversion ctor, so we only have to check whether T can be statically cast to its base class
|
||||
// BaseExpr<T>.
|
||||
enum { value = internal::is_convertible<T, BaseExpr<T> >::value };
|
||||
enum { value = internal::is_convertible<T, BaseExpr<T>>::value };
|
||||
};
|
||||
|
||||
// A simple wrapper around an integral value to provide the eval method.
|
||||
@ -317,7 +317,7 @@ struct EvalSymbolValueHelper<Tag, T1, OtherTypes...> {
|
||||
|
||||
/** Expression of a symbol uniquely identified by the template parameter type \c tag */
|
||||
template <typename tag>
|
||||
class SymbolExpr : public BaseExpr<SymbolExpr<tag> > {
|
||||
class SymbolExpr : public BaseExpr<SymbolExpr<tag>> {
|
||||
public:
|
||||
/** Alias to the template parameter \c tag */
|
||||
typedef tag Tag;
|
||||
@ -349,7 +349,7 @@ class SymbolExpr : public BaseExpr<SymbolExpr<tag> > {
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
class NegateExpr : public BaseExpr<NegateExpr<Arg0> > {
|
||||
class NegateExpr : public BaseExpr<NegateExpr<Arg0>> {
|
||||
public:
|
||||
constexpr NegateExpr() = default;
|
||||
constexpr NegateExpr(const Arg0& arg0) : m_arg0(arg0) {}
|
||||
@ -370,7 +370,7 @@ class NegateExpr : public BaseExpr<NegateExpr<Arg0> > {
|
||||
};
|
||||
|
||||
template <typename Arg0, typename Arg1>
|
||||
class AddExpr : public BaseExpr<AddExpr<Arg0, Arg1> > {
|
||||
class AddExpr : public BaseExpr<AddExpr<Arg0, Arg1>> {
|
||||
public:
|
||||
constexpr AddExpr() = default;
|
||||
constexpr AddExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {}
|
||||
@ -393,7 +393,7 @@ class AddExpr : public BaseExpr<AddExpr<Arg0, Arg1> > {
|
||||
};
|
||||
|
||||
template <typename Arg0, typename Arg1>
|
||||
class ProductExpr : public BaseExpr<ProductExpr<Arg0, Arg1> > {
|
||||
class ProductExpr : public BaseExpr<ProductExpr<Arg0, Arg1>> {
|
||||
public:
|
||||
constexpr ProductExpr() = default;
|
||||
constexpr ProductExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {}
|
||||
@ -416,7 +416,7 @@ class ProductExpr : public BaseExpr<ProductExpr<Arg0, Arg1> > {
|
||||
};
|
||||
|
||||
template <typename Arg0, typename Arg1>
|
||||
class QuotientExpr : public BaseExpr<QuotientExpr<Arg0, Arg1> > {
|
||||
class QuotientExpr : public BaseExpr<QuotientExpr<Arg0, Arg1>> {
|
||||
public:
|
||||
constexpr QuotientExpr() = default;
|
||||
constexpr QuotientExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {}
|
||||
|
@ -1233,7 +1233,7 @@ void BDCSVD<MatrixType, Options>::deflation44(Index firstColu, Index firstColm,
|
||||
using std::conj;
|
||||
using std::pow;
|
||||
using std::sqrt;
|
||||
|
||||
|
||||
RealScalar s = m_computed(firstColm + i, firstColm);
|
||||
RealScalar c = m_computed(firstColm + j, firstColm);
|
||||
RealScalar r = numext::hypot(c, s);
|
||||
@ -1424,8 +1424,7 @@ void BDCSVD<MatrixType, Options>::deflation(Index firstCol, Index lastCol, Index
|
||||
if ((diag(i) - diag(i - 1)) < epsilon_strict) {
|
||||
#ifdef EIGEN_BDCSVD_DEBUG_VERBOSE
|
||||
std::cout << "deflation 4.4 with i = " << i << " because " << diag(i) << " - " << diag(i - 1)
|
||||
<< " == " << (diag(i) - diag(i - 1)) << " < "
|
||||
<< epsilon_strict << "\n";
|
||||
<< " == " << (diag(i) - diag(i - 1)) << " < " << epsilon_strict << "\n";
|
||||
#endif
|
||||
eigen_internal_assert(abs(diag(i) - diag(i - 1)) < epsilon_coarse &&
|
||||
" diagonal entries are not properly sorted");
|
||||
|
11
scripts/format.sh
Executable file
11
scripts/format.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Format files with extensions, excluding plugins because they're partial files that don't contain valid syntax
|
||||
find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cu' -o -name '*.cxx' -o -name '*.h' -o -name '*.inc' -not -path '*/plugins/*' \) | xargs -n 1 -P 0 clang-format-17 -i
|
||||
|
||||
# Format main headers without extensions
|
||||
find Eigen -maxdepth 1 -type f | xargs -n 1 -P 0 clang-format-17 -i
|
||||
find unsupported/Eigen -maxdepth 2 -type f -not -name '*.txt' | xargs -n 1 -P 0 clang-format-17 -i
|
||||
|
||||
# Format examples
|
||||
find doc/examples -type f -name '*.cpp.*' | xargs -n 1 -P 0 clang-format-17 -i
|
@ -960,9 +960,9 @@ void array_complex(const ArrayType& m) {
|
||||
// Check for larger magnitude complex numbers that expm1 matches exp - 1.
|
||||
VERIFY_IS_APPROX(expm1(10. * m1), exp(10. * m1) - 1.);
|
||||
|
||||
VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1)));
|
||||
VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1)));
|
||||
VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1))));
|
||||
VERIFY_IS_APPROX(sinh(m1), 0.5 * (exp(m1) - exp(-m1)));
|
||||
VERIFY_IS_APPROX(cosh(m1), 0.5 * (exp(m1) + exp(-m1)));
|
||||
VERIFY_IS_APPROX(tanh(m1), (0.5 * (exp(m1) - exp(-m1))) / (0.5 * (exp(m1) + exp(-m1))));
|
||||
VERIFY_IS_APPROX(logistic(m1), (1.0 / (1.0 + exp(-m1))));
|
||||
if (m1.size() > 0) {
|
||||
// Complex exponential overflow edge-case.
|
||||
|
@ -140,7 +140,8 @@ void comparisons(const MatrixType& m) {
|
||||
// and/or
|
||||
VERIFY(((m1.array() < RealScalar(0)).matrix() && (m1.array() > RealScalar(0)).matrix()).count() == 0);
|
||||
VERIFY(((m1.array() < RealScalar(0)).matrix() || (m1.array() >= RealScalar(0)).matrix()).count() == rows * cols);
|
||||
VERIFY(((m1.array() < -mid).matrix() || (m1.array() > mid).matrix()).count() == (m1.cwiseAbs().array() > mid).count());
|
||||
VERIFY(((m1.array() < -mid).matrix() || (m1.array() > mid).matrix()).count() ==
|
||||
(m1.cwiseAbs().array() > mid).count());
|
||||
|
||||
typedef Matrix<Index, Dynamic, 1> VectorOfIndices;
|
||||
|
||||
|
@ -239,18 +239,16 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor(const Self& other) : Base(other), m_storage(other.m_storage) {}
|
||||
|
||||
template<typename... IndexTypes>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor(Index firstDimension, IndexTypes... otherDimensions)
|
||||
: m_storage(firstDimension, otherDimensions...)
|
||||
{
|
||||
// The number of dimensions used to construct a tensor must be equal to the rank of the tensor.
|
||||
EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||
}
|
||||
template <typename... IndexTypes>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor(Index firstDimension, IndexTypes... otherDimensions)
|
||||
: m_storage(firstDimension, otherDimensions...) {
|
||||
// The number of dimensions used to construct a tensor must be equal to the rank of the tensor.
|
||||
EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||
}
|
||||
|
||||
/** Normal Dimension */
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Tensor(const array<Index, NumIndices>& dimensions)
|
||||
: m_storage(internal::array_prod(dimensions), dimensions)
|
||||
{
|
||||
/** Normal Dimension */
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Tensor(const array<Index, NumIndices>& dimensions)
|
||||
: m_storage(internal::array_prod(dimensions), dimensions) {
|
||||
EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
|
||||
}
|
||||
|
||||
|
@ -215,14 +215,13 @@ struct DSizes : array<DenseIndex, NumDims> {
|
||||
}
|
||||
|
||||
template <typename... IndexTypes>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit DSizes(DenseIndex firstDimension, DenseIndex secondDimension,
|
||||
IndexTypes... otherDimensions)
|
||||
: Base({{firstDimension, secondDimension, otherDimensions...}}){EIGEN_STATIC_ASSERT(
|
||||
sizeof...(otherDimensions) + 2 == NumDims, YOU_MADE_A_PROGRAMMING_MISTAKE)}
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit DSizes(DenseIndex firstDimension, DenseIndex secondDimension,
|
||||
IndexTypes... otherDimensions)
|
||||
: Base({{firstDimension, secondDimension, otherDimensions...}}) {
|
||||
EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 2 == NumDims, YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC DSizes
|
||||
&
|
||||
operator=(const array<DenseIndex, NumDims>& other) {
|
||||
EIGEN_DEVICE_FUNC DSizes& operator=(const array<DenseIndex, NumDims>& other) {
|
||||
*static_cast<Base*>(this) = other;
|
||||
return *this;
|
||||
}
|
||||
|
@ -367,7 +367,8 @@ struct TensorPrinter<Tensor, rank, TensorIOFormatLegacy, std::enable_if_t<rank !
|
||||
const IndexType total_size = internal::array_prod(tensor.dimensions());
|
||||
if (total_size > 0) {
|
||||
const IndexType first_dim = Eigen::internal::array_get<0>(tensor.dimensions());
|
||||
Map<const Array<Scalar, Dynamic, Dynamic, Tensor::Layout>> matrix(tensor.data(), first_dim, total_size / first_dim);
|
||||
Map<const Array<Scalar, Dynamic, Dynamic, Tensor::Layout>> matrix(tensor.data(), first_dim,
|
||||
total_size / first_dim);
|
||||
s << matrix;
|
||||
return;
|
||||
}
|
||||
|
@ -79,14 +79,14 @@ class TensorMap : public TensorBase<TensorMap<PlainObjectType, Options_, MakePoi
|
||||
template <typename... IndexTypes>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index firstDimension,
|
||||
IndexTypes... otherDimensions)
|
||||
: m_data(dataPtr),
|
||||
m_dimensions(firstDimension, otherDimensions...){
|
||||
// The number of dimensions used to construct a tensor must be equal to the rank of the tensor.
|
||||
EIGEN_STATIC_ASSERT((sizeof...(otherDimensions) + 1 == NumIndices || NumIndices == Dynamic),
|
||||
YOU_MADE_A_PROGRAMMING_MISTAKE)}
|
||||
: m_data(dataPtr), m_dimensions(firstDimension, otherDimensions...) {
|
||||
// The number of dimensions used to construct a tensor must be equal to the rank of the tensor.
|
||||
EIGEN_STATIC_ASSERT((sizeof...(otherDimensions) + 1 == NumIndices || NumIndices == Dynamic),
|
||||
YOU_MADE_A_PROGRAMMING_MISTAKE)
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr,
|
||||
const array<Index, NumIndices>& dimensions)
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr,
|
||||
const array<Index, NumIndices>& dimensions)
|
||||
: m_data(dataPtr), m_dimensions(dimensions) {}
|
||||
|
||||
template <typename Dimensions>
|
||||
|
@ -231,7 +231,7 @@ class FFT {
|
||||
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES)
|
||||
|
||||
if (nfft < 1) nfft = src.size();
|
||||
|
||||
|
||||
Index dst_size = nfft;
|
||||
if (NumTraits<src_type>::IsComplex == 0 && HasFlag(HalfSpectrum)) {
|
||||
dst_size = (nfft >> 1) + 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user