block_matrix.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
33 #ifndef ACADO_TOOLKIT_BLOCK_MATRIX_HPP
34 #define ACADO_TOOLKIT_BLOCK_MATRIX_HPP
35 
37 
39 
53 {
54  //
55  // PUBLIC MEMBER FUNCTIONS:
56  //
57  public:
58 
60  BlockMatrix( );
61 
63  BlockMatrix( uint _nRows,
64  uint _nCols );
65 
67  BlockMatrix( const DMatrix& value
68  );
69 
71  virtual ~BlockMatrix( );
72 
74  returnValue init( uint _nRows, uint _nCols );
75 
78  returnValue setDense( uint rowIdx,
79  uint colIdx,
80  const DMatrix& value );
81 
84  returnValue addDense( uint rowIdx,
85  uint colIdx,
86  const DMatrix& value );
87 
91  inline returnValue getSubBlock( uint rowIdx,
92  uint colIdx,
93  DMatrix &value ) const;
94 
99  returnValue getSubBlock( uint rowIdx,
100  uint colIdx,
101  DMatrix &value,
102  uint nR,
103  uint nC ) const;
104 
107  BlockMatrix operator+( const BlockMatrix& arg ) const;
108 
111  BlockMatrix& operator+=( const BlockMatrix& arg );
112 
116  BlockMatrix operator-( const BlockMatrix& arg ) const;
117 
120  BlockMatrix operator*=( double scalar );
121 
125  BlockMatrix operator*( const BlockMatrix& arg ) const;
126 
130  BlockMatrix operator^( const BlockMatrix& arg ) const;
131 
134  inline uint getNumRows( ) const;
135 
138  inline uint getNumCols( ) const;
139 
142  inline uint getNumRows( uint rowIdx, uint colIdx ) const;
143 
146  inline uint getNumCols( uint rowIdx, uint colIdx ) const;
147 
150  inline returnValue setIdentity( uint rowIdx,
151  uint colIdx,
152  uint dim );
153 
156  inline returnValue setZero( uint rowIdx, uint colIdx );
157 
159  inline bool isEmpty() const;
160 
163  inline returnValue setZero();
164 
167  inline returnValue addRegularisation( uint rowIdx, uint colIdx, double eps );
168 
171  inline BlockMatrix addRegularisation( double eps );
172 
174  BlockMatrix transpose() const;
175 
178  inline bool isSquare( ) const;
179 
182  inline bool isSquare( uint rowIdx, uint colIdx ) const;
183 
187  BlockMatrix getAbsolute( ) const;
188 
193  BlockMatrix getPositive( ) const;
194 
199  BlockMatrix getNegative( ) const;
200 
203  returnValue print( std::ostream& stream = std::cout
204  ) const;
205 
206  //
207  // DATA MEMBERS:
208  //
209  protected:
210 
214  std::vector< std::vector< DMatrix > > elements;
215  std::vector< std::vector< SubBlockMatrixType > > types;
216 };
217 
220 
222 
223 #include <acado/matrix_vector/block_matrix.ipp>
224 
225 #endif // ACADO_TOOLKIT_BLOCK_MATRIX_HPP
226 
227 /*
228  * end of file
229  */
Implements a very rudimentary block sparse matrix class.
virtual ~BlockMatrix()
returnValue print(std::ostream &stream=std::cout) const
BlockMatrix transpose() const
returnValue setDense(uint rowIdx, uint colIdx, const DMatrix &value)
Allows to pass back messages to the calling function.
BlockMatrix operator^(const BlockMatrix &arg) const
static const BlockMatrix emptyConstBlockMatrix
BlockMatrix getAbsolute() const
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
BlockMatrix operator+(const BlockMatrix &arg) const
#define CLOSE_NAMESPACE_ACADO
BlockMatrix getNegative() const
BlockMatrix operator-(const BlockMatrix &arg) const
static BlockMatrix emptyBlockMatrix
returnValue getSubBlock(uint rowIdx, uint colIdx, DMatrix &value) const
std::vector< std::vector< SubBlockMatrixType > > types
returnValue init(uint _nRows, uint _nCols)
BlockMatrix & operator+=(const BlockMatrix &arg)
bool isSquare() const
BlockMatrix getPositive() const
bool isEmpty() const
BlockMatrix operator*(const BlockMatrix &arg) const
uint getNumCols() const
BlockMatrix operator*=(double scalar)
#define BEGIN_NAMESPACE_ACADO
returnValue addRegularisation(uint rowIdx, uint colIdx, double eps)
returnValue setIdentity(uint rowIdx, uint colIdx, uint dim)
returnValue addDense(uint rowIdx, uint colIdx, const DMatrix &value)
std::vector< std::vector< DMatrix > > elements
returnValue setZero()
uint getNumRows() const


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