Eigen  3.4.90 (git rev 5a9f66fb35d03a4da9ef8976e67a61b30aa16dcf)
 
Loading...
Searching...
No Matches
ReshapedHelper.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2017 Gael Guennebaud <[email protected]>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_RESHAPED_HELPER_H
11#define EIGEN_RESHAPED_HELPER_H
12
13// IWYU pragma: private
14#include "../InternalHeaderCheck.h"
15
16namespace Eigen {
17
18enum AutoSize_t { AutoSize };
19const int AutoOrder = 2;
20
21namespace internal {
22
23template <typename SizeType, typename OtherSize, int TotalSize>
24struct get_compiletime_reshape_size {
25 enum { value = get_fixed_value<SizeType>::value };
26};
27
28template <typename SizeType>
29Index get_runtime_reshape_size(SizeType size, Index /*other*/, Index /*total*/) {
30 return internal::get_runtime_value(size);
31}
32
33template <typename OtherSize, int TotalSize>
34struct get_compiletime_reshape_size<AutoSize_t, OtherSize, TotalSize> {
35 enum {
36 other_size = get_fixed_value<OtherSize>::value,
37 value = (TotalSize == Dynamic || other_size == Dynamic) ? Dynamic : TotalSize / other_size
38 };
39};
40
41inline Index get_runtime_reshape_size(AutoSize_t /*size*/, Index other, Index total) { return total / other; }
42
43constexpr inline int get_compiletime_reshape_order(int flags, int order) {
44 return order == AutoOrder ? flags & RowMajorBit : order;
45}
46
47} // namespace internal
48
49} // end namespace Eigen
50
51#endif // EIGEN_RESHAPED_HELPER_H
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition Core:137
const int Dynamic
Definition Constants.h:25