42 const std::string& _commonHeaderName
45 init(
"choleskyDecomposition", 0,
false);
73 s <<
"register unsigned i, j, k;" << endl
74 <<
"real_t inv;" << endl
75 <<
"for (i = 0; i < " << n <<
"; ++i)" << endl
77 <<
name <<
"[i * " << n <<
" + i] = " 78 <<
name <<
"[i * " << n <<
" + i] < 1e-8 ? 1e-8 : " 79 <<
"sqrt(" <<
name <<
"[i * " << n <<
" + i]);" << endl
81 <<
"inv = 1 / " <<
name <<
"[i * " << n <<
" + i];" << endl
83 <<
"for (j = i + 1; j < " << n <<
"; ++j)" << endl
84 <<
name <<
"[j * " << n <<
" + i] = " <<
name <<
"[j * " << n <<
" + i] * inv;" << endl
86 <<
"for (j = i + 1; j < " << n <<
"; ++j)" << endl
87 <<
"for (k = j; k < " << n <<
"; ++k)" << endl
88 <<
name <<
"[k * " << n <<
" + j] = " <<
name <<
"[k * " << n <<
" + j] - " 89 <<
name <<
"[k * " << n <<
" + i] * " <<
name <<
"[j * " << n <<
" + i];" << endl
93 <<
"for (i = 0; i < " << n <<
"; ++i)" << endl
94 <<
"for (j = i + 1; j < " << n <<
"; ++j)" << endl
95 <<
name <<
"[i * " << n <<
" + j] = 0.0;" << endl
96 << ret.
getName() <<
" = 0;" << endl;
virtual returnValue setup()
ExportVariable & setup(const std::string &_name, uint _nRows=1, uint _nCols=1, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string())
returnValue init(const std::string &_name="defaultFunctionName", const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
Allows to pass back messages to the calling function.
ExportCholeskyDecomposition(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
const std::string getName()
#define CLOSE_NAMESPACE_ACADO
Allows to export automatically generated algorithms for fast model predictive control.
Encapsulates all user interaction for setting options, logging data and plotting results.
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
virtual uint getDim() const
returnValue addStatement(const ExportStatement &_statement)
ExportFunction & setReturnValue(const ExportVariable &_functionReturnValue, bool _returnAsPointer=false)
std::string getName() const
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
#define BEGIN_NAMESPACE_ACADO
virtual returnValue getCode(ExportStatementBlock &code)
returnValue addFunction(const ExportFunction &_function)
returnValue init(const std::string &_name, unsigned _dim, bool _unrolling=false)
Allows to export code for a block of statements.
Defines a matrix-valued variable to be used for exporting code.
std::string getName() const
virtual uint getNumRows() const