mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
Added missing APIs to the Eigen::Sizes class
This commit is contained in:
parent
05787f8367
commit
b756f6af5e
@ -124,15 +124,15 @@ struct Sizes : internal::numeric_list<std::ptrdiff_t, Indices...> {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t operator[] (const int index) const {
|
|
||||||
return internal::fixed_size_tensor_index_extraction_helper<std::ptrdiff_t, Base::count - 1>::run(index, *this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> Sizes& operator = (const T& /*other*/) {
|
template <typename T> Sizes& operator = (const T& /*other*/) {
|
||||||
// add assertion failure if the size of other is different
|
// add assertion failure if the size of other is different
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::ptrdiff_t operator[] (const int index) const {
|
||||||
|
return internal::fixed_size_tensor_index_extraction_helper<std::ptrdiff_t, Base::count - 1>::run(index, *this);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||||
size_t IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const {
|
size_t IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const {
|
||||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, false>::run(indices, *static_cast<const Base*>(this));
|
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, false>::run(indices, *static_cast<const Base*>(this));
|
||||||
@ -179,6 +179,11 @@ template <std::size_t V1=0, std::size_t V2=0, std::size_t V3=0, std::size_t V4=0
|
|||||||
explicit Sizes(const array<DenseIndex, Base::count>& /*indices*/) {
|
explicit Sizes(const array<DenseIndex, Base::count>& /*indices*/) {
|
||||||
// todo: add assertion
|
// todo: add assertion
|
||||||
}
|
}
|
||||||
|
template <typename T> Sizes& operator = (const T& /*other*/) {
|
||||||
|
// add assertion failure if the size of other is different
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef EIGEN_HAS_VARIADIC_TEMPLATES
|
#ifdef EIGEN_HAS_VARIADIC_TEMPLATES
|
||||||
template <typename... DenseIndex> Sizes(DenseIndex... /*indices*/) { }
|
template <typename... DenseIndex> Sizes(DenseIndex... /*indices*/) { }
|
||||||
explicit Sizes(std::initializer_list<std::size_t>) {
|
explicit Sizes(std::initializer_list<std::size_t>) {
|
||||||
@ -215,11 +220,6 @@ template <std::size_t V1=0, std::size_t V2=0, std::size_t V3=0, std::size_t V4=0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> Sizes& operator = (const T&) {
|
|
||||||
// to do: check the size of other
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
template <typename DenseIndex> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||||
size_t IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const {
|
size_t IndexOfColMajor(const array<DenseIndex, Base::count>& indices) const {
|
||||||
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, false>::run(indices, *reinterpret_cast<const Base*>(this));
|
return internal::fixed_size_tensor_index_linearization_helper<DenseIndex, Base::count, Base::count - 1, false>::run(indices, *reinterpret_cast<const Base*>(this));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user