Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen  3.4.0
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 namespace Eigen {
15 
16 namespace internal {
17 template<typename VectorType, int Size>
18 struct traits<VectorBlock<VectorType, Size> >
19  : public traits<Block<VectorType,
20  traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
21  traits<VectorType>::Flags & RowMajorBit ? Size : 1> >
22 {
23 };
24 }
25 
56 template<typename VectorType, int Size> class VectorBlock
57  : public Block<VectorType,
58  internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
59  internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1>
60 {
61  typedef Block<VectorType,
62  internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
63  internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1> Base;
64  enum {
65  IsColVector = !(internal::traits<VectorType>::Flags & RowMajorBit)
66  };
67  public:
68  EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock)
69 
70  using Base::operator=;
71 
74  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
75  VectorBlock(VectorType& vector, Index start, Index size)
76  : Base(vector,
77  IsColVector ? start : 0, IsColVector ? 0 : start,
78  IsColVector ? size : 1, IsColVector ? 1 : size)
79  {
80  EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock);
81  }
82 
85  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
86  VectorBlock(VectorType& vector, Index start)
87  : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start)
88  {
89  EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock);
90  }
91 };
92 
93 
94 } // end namespace Eigen
95 
96 #endif // EIGEN_VECTORBLOCK_H
VectorBlock(VectorType &vector, Index start, Index size)
Definition: VectorBlock.h:75
Namespace containing all symbols from the Eigen library.
Definition: Core:141
const unsigned int RowMajorBit
Definition: Constants.h:66
Expression of a fixed-size or dynamic-size sub-vector.
Definition: VectorBlock.h:56
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: Eigen_Colamd.h:50
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
VectorBlock(VectorType &vector, Index start)
Definition: VectorBlock.h:86