Block.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00010 
00011 #ifndef EIGEN_BLOCK2_H
00012 #define EIGEN_BLOCK2_H
00013 
00014 namespace Eigen { 
00015 
00032 template<typename Derived>
00033 inline Block<Derived> DenseBase<Derived>
00034   ::corner(CornerType type, Index cRows, Index cCols)
00035 {
00036   switch(type)
00037   {
00038     default:
00039       eigen_assert(false && "Bad corner type.");
00040     case TopLeft:
00041       return Block<Derived>(derived(), 0, 0, cRows, cCols);
00042     case TopRight:
00043       return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00044     case BottomLeft:
00045       return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00046     case BottomRight:
00047       return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00048   }
00049 }
00050 
00052 template<typename Derived>
00053 inline const Block<Derived>
00054 DenseBase<Derived>::corner(CornerType type, Index cRows, Index cCols) const
00055 {
00056   switch(type)
00057   {
00058     default:
00059       eigen_assert(false && "Bad corner type.");
00060     case TopLeft:
00061       return Block<Derived>(derived(), 0, 0, cRows, cCols);
00062     case TopRight:
00063       return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
00064     case BottomLeft:
00065       return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
00066     case BottomRight:
00067       return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
00068   }
00069 }
00070 
00083 template<typename Derived>
00084 template<int CRows, int CCols>
00085 inline Block<Derived, CRows, CCols>
00086 DenseBase<Derived>::corner(CornerType type)
00087 {
00088   switch(type)
00089   {
00090     default:
00091       eigen_assert(false && "Bad corner type.");
00092     case TopLeft:
00093       return Block<Derived, CRows, CCols>(derived(), 0, 0);
00094     case TopRight:
00095       return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00096     case BottomLeft:
00097       return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00098     case BottomRight:
00099       return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00100   }
00101 }
00102 
00104 template<typename Derived>
00105 template<int CRows, int CCols>
00106 inline const Block<Derived, CRows, CCols>
00107 DenseBase<Derived>::corner(CornerType type) const
00108 {
00109   switch(type)
00110   {
00111     default:
00112       eigen_assert(false && "Bad corner type.");
00113     case TopLeft:
00114       return Block<Derived, CRows, CCols>(derived(), 0, 0);
00115     case TopRight:
00116       return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
00117     case BottomLeft:
00118       return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
00119     case BottomRight:
00120       return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
00121   }
00122 }
00123 
00124 } // end namespace Eigen
00125 
00126 #endif // EIGEN_BLOCK2_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:57:54