Eigen2Support/Block.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2009 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_BLOCK2_H
12 #define EIGEN_BLOCK2_H
13 
14 namespace Eigen {
15 
32 template<typename Derived>
33 inline Block<Derived> DenseBase<Derived>
34  ::corner(CornerType type, Index cRows, Index cCols)
35 {
36  switch(type)
37  {
38  default:
39  eigen_assert(false && "Bad corner type.");
40  case TopLeft:
41  return Block<Derived>(derived(), 0, 0, cRows, cCols);
42  case TopRight:
43  return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
44  case BottomLeft:
45  return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
46  case BottomRight:
47  return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
48  }
49 }
50 
52 template<typename Derived>
53 inline const Block<Derived>
54 DenseBase<Derived>::corner(CornerType type, Index cRows, Index cCols) const
55 {
56  switch(type)
57  {
58  default:
59  eigen_assert(false && "Bad corner type.");
60  case TopLeft:
61  return Block<Derived>(derived(), 0, 0, cRows, cCols);
62  case TopRight:
63  return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
64  case BottomLeft:
65  return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
66  case BottomRight:
67  return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
68  }
69 }
70 
83 template<typename Derived>
84 template<int CRows, int CCols>
85 inline Block<Derived, CRows, CCols>
86 DenseBase<Derived>::corner(CornerType type)
87 {
88  switch(type)
89  {
90  default:
91  eigen_assert(false && "Bad corner type.");
92  case TopLeft:
93  return Block<Derived, CRows, CCols>(derived(), 0, 0);
94  case TopRight:
95  return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
96  case BottomLeft:
97  return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
98  case BottomRight:
99  return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
100  }
101 }
102 
104 template<typename Derived>
105 template<int CRows, int CCols>
106 inline const Block<Derived, CRows, CCols>
107 DenseBase<Derived>::corner(CornerType type) const
108 {
109  switch(type)
110  {
111  default:
112  eigen_assert(false && "Bad corner type.");
113  case TopLeft:
114  return Block<Derived, CRows, CCols>(derived(), 0, 0);
115  case TopRight:
116  return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
117  case BottomLeft:
118  return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
119  case BottomRight:
120  return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
121  }
122 }
123 
124 } // end namespace Eigen
125 
126 #endif // EIGEN_BLOCK2_H
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: matrix.hpp:471
#define eigen_assert(x)


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:29