Eigen  3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)
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 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 namespace internal {
19 template<typename VectorType, int Size>
20 struct traits<VectorBlock<VectorType, Size> >
21  : public traits<Block<VectorType,
22  traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
23  traits<VectorType>::Flags & RowMajorBit ? Size : 1> >
24 {
25 };
26 }
27 
58 template<typename VectorType, int Size> class VectorBlock
59  : public Block<VectorType,
60  internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
61  internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1>
62 {
63  typedef Block<VectorType,
64  internal::traits<VectorType>::Flags & RowMajorBit ? 1 : Size,
65  internal::traits<VectorType>::Flags & RowMajorBit ? Size : 1> Base;
66  enum {
67  IsColVector = !(internal::traits<VectorType>::Flags & RowMajorBit)
68  };
69  public:
70  EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock)
71  EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock)
72 
73  using Base::operator=;
74 
77  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
78  VectorBlock(VectorType& vector, Index start, Index size)
79  : Base(vector,
80  IsColVector ? start : 0, IsColVector ? 0 : start,
81  IsColVector ? size : 1, IsColVector ? 1 : size)
82  { }
83 
86  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
87  VectorBlock(VectorType& vector, Index start)
88  : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start)
89  { }
90 };
91 
92 
93 } // end namespace Eigen
94 
95 #endif // EIGEN_VECTORBLOCK_H
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:107
Expression of a fixed-size or dynamic-size sub-vector.
Definition: VectorBlock.h:62
VectorBlock(VectorType &vector, Index start, Index size)
Definition: VectorBlock.h:78
VectorBlock(VectorType &vector, Index start)
Definition: VectorBlock.h:87
const unsigned int RowMajorBit
Definition: Constants.h:68
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59