11 #ifndef EIGEN_INTEGRAL_CONSTANT_H
12 #define EIGEN_INTEGRAL_CONSTANT_H
14 #include "../InternalHeaderCheck.h"
20 template<
int N>
class FixedInt;
21 template<
int N>
class VariableAndFixedInt;
51 template<
int N>
class FixedInt
54 static const int value = N;
61 FixedInt(std::integral_constant<int,N>) {}
64 FixedInt( VariableAndFixedInt<N> other) {
65 #ifndef EIGEN_INTERNAL_DEBUGGING
72 FixedInt<-N>
operator-()
const {
return FixedInt<-N>(); }
76 FixedInt<N+M>
operator+( FixedInt<M>)
const {
return FixedInt<N+M>(); }
80 FixedInt<N-
M>
operator-( FixedInt<M>)
const {
return FixedInt<N-
M>(); }
84 FixedInt<N*M>
operator*( FixedInt<M>)
const {
return FixedInt<N*M>(); }
88 FixedInt<N/
M>
operator/( FixedInt<M>)
const {
return FixedInt<N/
M>(); }
92 FixedInt<N%M> operator%( FixedInt<M>)
const {
return FixedInt<N%M>(); }
96 FixedInt<N|M>
operator|( FixedInt<M>)
const {
return FixedInt<N|M>(); }
100 FixedInt<N&M>
operator&( FixedInt<M>)
const {
return FixedInt<N&M>(); }
105 VariableAndFixedInt<N>
operator() (
int val)
const {
return VariableAndFixedInt<N>(val); }
137 template<
int N>
class VariableAndFixedInt
140 static const int value = N;
141 operator int()
const {
return m_value; }
142 VariableAndFixedInt(
int val) { m_value = val; }
147 template<
typename T,
int Default=Dynamic>
struct get_fixed_value {
148 static const int value =
Default;
151 template<
int N,
int Default>
struct get_fixed_value<FixedInt<N>,
Default> {
152 static const int value = N;
155 template<
int N,
int Default>
struct get_fixed_value<VariableAndFixedInt<N>,
Default> {
156 static const int value = N ;
159 template<
typename T,
int N,
int Default>
160 struct get_fixed_value<variable_if_dynamic<
T,N>,
Default> {
161 static const int value = N;
169 template<
typename T,
int DynamicKey=Dynamic,
typename EnableIf=
void>
struct cleanup_index_type {
typedef T type; };
172 template<
typename T,
int DynamicKey>
struct cleanup_index_type<
T,DynamicKey,
std::enable_if_t<internal::is_integral<T>::value>> {
typedef Index type; };
175 template<
int N,
int DynamicKey>
struct cleanup_index_type<VariableAndFixedInt<N>, DynamicKey> {
typedef FixedInt<N> type; };
177 template<
int DynamicKey>
struct cleanup_index_type<VariableAndFixedInt<DynamicKey>, DynamicKey> {
typedef Index type; };
179 template<
int N,
int DynamicKey>
struct cleanup_index_type<
std::integral_constant<int,N>, DynamicKey> {
typedef FixedInt<N> type; };
183 #ifndef EIGEN_PARSED_BY_DOXYGEN
186 constexpr internal::FixedInt<N>
fix{};
246 static const auto fix(
int val);
const CwiseBinaryOp< internal::scalar_bitwise_or_op< Scalar >, const Derived, const OtherDerived > operator|(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
const CwiseBinaryOp< internal::scalar_bitwise_and_op< Scalar >, const Derived, const OtherDerived > operator&(const EIGEN_CURRENT_STORAGE_BASE_CLASS< OtherDerived > &other) const
IndexedView_or_Block operator()(const RowIndices &rowIndices, const ColIndices &colIndices)
#define eigen_internal_assert(x)
#define EIGEN_UNUSED_VARIABLE(var)
#define EIGEN_DEVICE_FUNC
bfloat16 operator/(const bfloat16 &a, const bfloat16 &b)
Index get_runtime_value(const T &x)
const CwiseBinaryOp< internal::scalar_difference_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator-(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
const CwiseBinaryOp< internal::scalar_sum_op< typename DenseDerived::Scalar, typename SparseDerived::Scalar >, const DenseDerived, const SparseDerived > operator+(const MatrixBase< DenseDerived > &a, const SparseMatrixBase< SparseDerived > &b)