$darkmode
Eigen  5.0.1-dev
VectorBlock.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_VECTORBLOCK_H
12 #define EIGEN_VECTORBLOCK_H
13 
14 // IWYU pragma: private
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 template <typename VectorType, int Size>
21 struct traits<VectorBlock<VectorType, Size> >
22  : public traits<Block<VectorType, traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
23  traits<VectorType>::Flags & RowMajorBit ? Size : 1> > {};
24 } // namespace internal
25 
56 template <typename VectorType, int Size>
57 class VectorBlock : public Block<VectorType, internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
58  internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1> {
59  typedef Block<VectorType, internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
60  internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1>
61  Base;
62  enum { IsColVector = !(internal::traits<VectorType>::Flags & RowMajorBit) };
63 
64  public:
65  EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock)
66  EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock)
67  EIGEN_INHERIT_ASSIGNMENT_OPERATORS(VectorBlock)
68 
69 
71  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE VectorBlock(VectorType& vector, Index start, Index size)
72  : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start, IsColVector ? size : 1, IsColVector ? 1 : size) {
73  }
74 
77  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE VectorBlock(VectorType& vector, Index start)
78  : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start) {}
79 };
80 
81 } // end namespace Eigen
82 
83 #endif // EIGEN_VECTORBLOCK_H
VectorBlock(VectorType &vector, Index start, Index size)
Definition: VectorBlock.h:71
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
const unsigned int RowMajorBit
Definition: Constants.h:70
Expression of a fixed-size or dynamic-size sub-vector.
Definition: ForwardDeclarations.h:98
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
VectorBlock(VectorType &vector, Index start)
Definition: VectorBlock.h:77