44 std::vector< std::vector< T > >& _values
46 :
Base(_nRows, _nCols)
48 ASSERT( _values.size() > 0 );
50 unsigned nRows = _values.size();
51 unsigned nCols = _values[ 0 ].size();
53 for (
unsigned r = 0; r < nRows; ++r)
55 ASSERT( _values[ r ].size() == nCols );
57 std::copy(_values[ r ].begin(), _values[ r ].end(),
Base::data() + r * nCols);
74 unsigned argRows = _arg.
rows();
95 unsigned argCols = _arg.
cols();
132 {
return Base::diagonal(); }
149 for (
unsigned c = r + 1; c <
getNumRows(); ++c)
150 if (
acadoIsEqual(Base::operator()(r, c), Base::operator()(c, r)) ==
false)
162 for (
unsigned j = i + 1; j <
getNumRows(); ++j)
164 T m = (Base::operator()(i, j) + Base::operator()(j, i)) /
T( 2 );
165 Base::operator()(i, j) = m;
166 Base::operator()(j, i) = m;
200 unsigned dim = foo.
rows() * foo.
cols();
201 for (
unsigned el = 0; el < dim; ++el)
203 T bar = foo.
data()[ el ];
205 foo.
data()[ el ] =
T( 0 );
215 unsigned dim = foo.
rows() * foo.
cols();
216 for (
unsigned el = 0; el < dim; ++el)
218 T bar = foo.
data()[ el ];
220 foo.
data()[ el ] =
T( 0 );
228 {
return Base::norm(); }
232 {
return Base::trace(); }
250 return (
V( 0 ) /
V(V.size() - 1));
255 const std::string& _name,
256 const std::string& _startString,
257 const std::string& _endString,
260 const std::string& _colSeparator,
261 const std::string& _rowSeparator
265 _stream << _name <<
" = ";
267 _stream << _startString;
273 _stream << Base::operator()(r, c);
275 if (c < (Base::cols() - 1))
276 _stream << _colSeparator;
279 if (r < (Base::rows() - 1))
280 _stream << _rowSeparator;
283 _stream << _endString;
290 const std::string& _name,
291 const std::string& _startString,
292 const std::string& _endString,
295 const std::string& _colSeparator,
296 const std::string& _rowSeparator
302 _stream << _name <<
" = ";
304 _stream << _startString;
308 _precision > 0 ? ios::scientific | ios::right : ios::fixed);
314 _stream << Base::operator()(r, c);
316 if (c < (Base::cols() - 1))
317 _stream << _colSeparator;
320 if (r < (Base::rows() - 1))
321 _stream << _rowSeparator;
324 _stream << _endString;
333 const std::string& _name,
339 switch ( _printScheme )
344 matFile->
write(_stream, *
this, _name.c_str());
351 char* startString = 0;
355 char* colSeparator = 0;
356 char* rowSeparator = 0;
359 &endString, width, precision, &colSeparator, &rowSeparator);
364 precision, colSeparator, rowSeparator);
366 if ( startString != 0 )
delete[] startString;
367 if ( endString != 0 )
delete[] endString;
368 if ( colSeparator != 0 )
delete[] colSeparator;
369 if ( rowSeparator != 0 )
delete[] rowSeparator;
377 const std::string& _name,
378 const std::string& _startString,
379 const std::string& _endString,
382 const std::string& _colSeparator,
383 const std::string& _rowSeparator
386 ofstream stream( _filename.c_str() );
388 if ( stream.is_open() )
389 return print(stream, _name, _startString, _endString, _width, _precision,
390 _colSeparator, _rowSeparator);
401 const std::string& _name,
405 ofstream stream( _filename.c_str() );
408 if ( stream.is_open() )
409 status =
print(stream, _name, _printScheme);
421 vector< vector< T > > tmp;
431 unsigned nc = tmp[ 0 ].size();
432 unsigned nr = tmp.size();
433 for (
unsigned r = 0; r < nr; ++r)
434 if (tmp[ r ].size() != nc)
445 ifstream stream( _filename.c_str() );
448 if (stream.is_open())
449 status =
read( stream );
returnValue getGlobalStringDefinitions(PrintScheme _printScheme, char **_startString, char **_endString, uint &_width, uint &_precision, char **_colSeparator, char **_rowSeparator)
Robust Cholesky decomposition of a matrix with pivoting.
USING_NAMESPACE_ACADO typedef TaylorVariable< Interval > T
GenericVector< T > sumCol() const
bool isPositiveSemiDefinite() const
EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, Index nbCols)
BooleanType acadoIsEqual(double x, double y, double TOL)
GenericMatrix & appendCols(const GenericMatrix &_arg)
Allows to pass back messages to the calling function.
std::string operator==(const ExportIndex &_arg1, const ExportIndex &_arg2)
GenericMatrix & makeVector()
Block< Derived > block(Index startRow, Index startCol, Index blockRows, Index blockCols)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
const SingularValuesType & singularValues() const
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > cwiseAbs() const
GenericMatrix & appendRows(const GenericMatrix &_arg)
Simple class for writing binary data file that are compatible with Matlab.
#define CLOSE_NAMESPACE_ACADO
EIGEN_STRONG_INLINE Index rows() const
virtual returnValue print(std::ostream &_stream=std::cout, const std::string &_name=DEFAULT_LABEL, const std::string &_startString=DEFAULT_START_STRING, const std::string &_endString=DEFAULT_END_STRING, uint _width=DEFAULT_WIDTH, uint _precision=DEFAULT_PRECISION, const std::string &_colSeparator=DEFAULT_COL_SEPARATOR, const std::string &_rowSeparator=DEFAULT_ROW_SEPARATOR) const
T getConditionNumber() const
GenericMatrix positive() const
bool isPositiveDefinite() const
EIGEN_STRONG_INLINE const Scalar * data() const
virtual returnValue read(std::istream &_stream)
unsigned getNumRows() const
ComputationInfo info() const
Reports whether previous computation was successful.
EIGEN_STRONG_INLINE Derived & _set(const DenseBase< OtherDerived > &other)
Copies the value of the expression other into *this with automatic resizing.
GenericMatrix absolute() const
GenericVector< T > sumRow() const
Two-sided Jacobi SVD decomposition of a rectangular matrix.
#define BEGIN_NAMESPACE_ACADO
void write(std::ostream &stream, const GenericMatrix< T > &mat, const char *name)
EIGEN_STRONG_INLINE Index cols() const
GenericVector< T > getDiag() const
LDLT & compute(const MatrixType &matrix)
GenericMatrix negative() const
#define ACADOERROR(retval)