block_matrix.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00033 #ifndef ACADO_TOOLKIT_BLOCK_MATRIX_HPP
00034 #define ACADO_TOOLKIT_BLOCK_MATRIX_HPP
00035 
00036 #include <acado/utils/acado_types.hpp>
00037 
00038 BEGIN_NAMESPACE_ACADO
00039 
00052 class BlockMatrix
00053 {
00054     //
00055     // PUBLIC MEMBER FUNCTIONS:
00056     //
00057     public:
00058 
00060         BlockMatrix( );
00061 
00063         BlockMatrix( uint _nRows,       
00064                                      uint _nCols     );
00065 
00067         BlockMatrix(    const DMatrix& value
00068                                                 );
00069 
00071         virtual ~BlockMatrix( );
00072 
00074                 returnValue init( uint _nRows, uint _nCols );
00075 
00078                 returnValue setDense( uint           rowIdx, 
00079                               uint           colIdx, 
00080                               const DMatrix&  value );
00081 
00084                 returnValue addDense( uint           rowIdx, 
00085                               uint           colIdx, 
00086                               const DMatrix&  value );
00087 
00091                 inline returnValue getSubBlock( uint    rowIdx,  
00092                                         uint    colIdx,  
00093                                         DMatrix &value   )  const;
00094 
00099                 returnValue getSubBlock( uint    rowIdx,  
00100                                  uint    colIdx,  
00101                                  DMatrix &value,
00102                                  uint nR,
00103                                  uint nC          )  const;
00104 
00107                 BlockMatrix operator+( const BlockMatrix& arg    ) const;
00108 
00111                 BlockMatrix& operator+=( const BlockMatrix& arg  );
00112 
00116                 BlockMatrix operator-( const BlockMatrix& arg  ) const;
00117 
00120                 BlockMatrix operator*=( double scalar  );
00121 
00125                 BlockMatrix operator*( const BlockMatrix& arg  ) const;
00126 
00130                 BlockMatrix operator^( const BlockMatrix& arg    ) const;
00131 
00134                 inline uint getNumRows( ) const;
00135 
00138                 inline uint getNumCols( ) const;
00139 
00142                 inline uint getNumRows( uint rowIdx, uint colIdx ) const;
00143 
00146                 inline uint getNumCols( uint rowIdx, uint colIdx ) const;
00147 
00150                 inline returnValue setIdentity( uint rowIdx,  
00151                                         uint colIdx,  
00152                                         uint dim        );
00153 
00156                 inline returnValue setZero( uint rowIdx, uint colIdx );
00157 
00159                 inline bool isEmpty() const;
00160 
00163                 inline returnValue setZero();
00164 
00167                 inline returnValue addRegularisation( uint rowIdx, uint colIdx, double eps );
00168 
00171                 inline BlockMatrix addRegularisation( double eps );
00172 
00174         BlockMatrix transpose() const;
00175 
00178                 inline bool isSquare( ) const;
00179 
00182                 inline bool isSquare( uint rowIdx, uint colIdx ) const;
00183 
00187         BlockMatrix getAbsolute( ) const;
00188 
00193         BlockMatrix getPositive( ) const;
00194 
00199         BlockMatrix getNegative( ) const;
00200 
00203                 returnValue print(      std::ostream& stream = std::cout
00204                                                         ) const;
00205 
00206     //
00207     // DATA MEMBERS:
00208     //
00209     protected:
00210 
00211                 uint nRows;                     
00212                 uint nCols;                     
00214         std::vector< std::vector< DMatrix > > elements;
00215         std::vector< std::vector< SubBlockMatrixType > > types;
00216 };
00217 
00218 static       BlockMatrix emptyBlockMatrix;
00219 static const BlockMatrix emptyConstBlockMatrix;
00220 
00221 CLOSE_NAMESPACE_ACADO
00222 
00223 #include <acado/matrix_vector/block_matrix.ipp>
00224 
00225 #endif  // ACADO_TOOLKIT_BLOCK_MATRIX_HPP
00226 
00227 /*
00228  *      end of file
00229  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:36:47