#include <math.h>
#include <qpOASES/Utils.hpp>
Go to the source code of this file.
Functions | |
returnValue | convertBooleanTypeToString (BooleanType value, char *const string) |
returnValue | convertPrintLevelToString (PrintLevel value, char *const string) |
returnValue | convertSubjectToStatusToString (SubjectToStatus value, char *const string) |
real_t | getCPUtime () |
returnValue | getKktViolation (int_t nV, int_t nC, const real_t *const H, const real_t *const g, const real_t *const A, const real_t *const lb, const real_t *const ub, const real_t *const lbA, const real_t *const ubA, const real_t *const x, const real_t *const y, real_t &stat, real_t &feas, real_t &cmpl, const real_t *const workingSetB, const real_t *const workingSetC, BooleanType hasIdentityHessian) |
returnValue | getKktViolation (int_t nV, const real_t *const H, const real_t *const g, const real_t *const lb, const real_t *const ub, const real_t *const x, const real_t *const y, real_t &stat, real_t &feas, real_t &cmpl, const real_t *const workingSetB, BooleanType hasIdentityHessian) |
real_t | getNorm (const real_t *const v, int_t n, int_t type) |
int_t | getSimpleStatus (returnValue returnvalue, BooleanType doPrintStatus) |
returnValue | myPrintf (const char *s) |
returnValue | normaliseConstraints (int_t nV, int_t nC, real_t *A, real_t *lbA, real_t *ubA, int_t type) |
BEGIN_NAMESPACE_QPOASES returnValue | print (const real_t *const v, int_t n, const char *name) |
returnValue | print (const real_t *const v, int_t n, const int_t *const V_idx, const char *name) |
returnValue | print (const real_t *const M, int_t nrow, int_t ncol, const char *name) |
returnValue | print (const real_t *const M, int_t nrow, int_t ncol, const int_t *const ROW_idx, const int_t *const COL_idx, const char *name) |
returnValue | print (const int_t *const index, int_t n, const char *name) |
returnValue | printCopyrightNotice () |
returnValue | readFromFile (real_t *data, int_t nrow, int_t ncol, const char *datafilename) |
returnValue | readFromFile (real_t *data, int_t n, const char *datafilename) |
returnValue | readFromFile (int_t *data, int_t n, const char *datafilename) |
returnValue | writeIntoFile (const real_t *const data, int_t nrow, int_t ncol, const char *datafilename, BooleanType append) |
returnValue | writeIntoFile (const real_t *const data, int_t n, const char *datafilename, BooleanType append) |
returnValue | writeIntoFile (const int_t *const integer, int_t n, const char *datafilename, BooleanType append) |
returnValue | writeIntoMatFile (FILE *const matFile, const real_t *const data, int_t nRows, int_t nCols, const char *name) |
returnValue | writeIntoMatFile (FILE *const matFile, const int_t *const data, int_t nRows, int_t nCols, const char *name) |
returnValue convertBooleanTypeToString | ( | BooleanType | value, |
char *const | string | ||
) |
Writes a value of BooleanType into a string.
value | Value to be written. |
string | Input: String of sufficient size, Output: String containing value. |
Definition at line 812 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue convertPrintLevelToString | ( | PrintLevel | value, |
char *const | string | ||
) |
Writes a value of PrintLevel into a string.
value | Value to be written. |
string | Input: String of sufficient size, Output: String containing value. |
Definition at line 870 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue convertSubjectToStatusToString | ( | SubjectToStatus | value, |
char *const | string | ||
) |
Writes a value of SubjectToStatus into a string.
value | Value to be written. |
string | Input: String of sufficient size, Output: String containing value. |
Definition at line 828 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
real_t getCPUtime | ( | ) |
Returns the current system time.
Definition at line 581 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue getKktViolation | ( | int_t | nV, |
int_t | nC, | ||
const real_t *const | H, | ||
const real_t *const | g, | ||
const real_t *const | A, | ||
const real_t *const | lb, | ||
const real_t *const | ub, | ||
const real_t *const | lbA, | ||
const real_t *const | ubA, | ||
const real_t *const | x, | ||
const real_t *const | y, | ||
real_t & | stat, | ||
real_t & | feas, | ||
real_t & | cmpl, | ||
const real_t *const | workingSetB = 0 , |
||
const real_t *const | workingSetC = 0 , |
||
BooleanType | hasIdentityHessian = BT_FALSE |
||
) |
Computes the maximum violation of the KKT optimality conditions of given iterate for given QP data.
nV | Number of variables. |
nC | Number of constraints. |
H | Hessian matrix (may be NULL if Hessian is zero or identity matrix). |
g | Gradient vector. |
A | Constraint matrix. |
lb | Lower bound vector (on variables). |
ub | Upper bound vector (on variables). |
lbA | Lower constraints' bound vector. |
ubA | Upper constraints' bound vector. |
x | Primal trial vector. |
y | Dual trial vector. |
stat | Output: maximum value of stationarity condition residual. |
feas | Output: maximum value of primal feasibility violation. |
cmpl | Output: maximum value of complementarity residual. |
workingSetB | Working set of bounds (used to determine active bounds). |
workingSetC | Working set of constraints (used to determine active constraints). |
hasIdentityHessian | Indicating whether Hessian matrix is identity matrix or not if NULL pointer is passed. |
Definition at line 631 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue getKktViolation | ( | int_t | nV, |
const real_t *const | H, | ||
const real_t *const | g, | ||
const real_t *const | lb, | ||
const real_t *const | ub, | ||
const real_t *const | x, | ||
const real_t *const | y, | ||
real_t & | stat, | ||
real_t & | feas, | ||
real_t & | cmpl, | ||
const real_t *const | workingSetB = 0 , |
||
BooleanType | hasIdentityHessian = BT_FALSE |
||
) |
Computes the maximum violation of the KKT optimality conditions of given iterate for given QP data.
nV | Number of variables. |
H | Hessian matrix (may be NULL if Hessian is zero or identity matrix). |
g | Gradient vector. |
lb | Lower bound vector (on variables). |
ub | Upper bound vector (on variables). |
x | Primal trial vector. |
y | Dual trial vector. |
stat | Output: maximum value of stationarity condition residual. |
feas | Output: maximum value of primal feasibility violation. |
cmpl | Output: maximum value of complementarity residual. |
workingSetB | Working set of bounds (used to determine active bounds). |
hasIdentityHessian | Indicating whether Hessian matrix is identity matrix or not if NULL pointer is passed |
Definition at line 792 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
Returns the N-norm of a vector.
v | Vector. |
n | Vector's dimension. |
type | Norm type, 1: one-norm, 2: Euclidean norm. |
Definition at line 603 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
int_t getSimpleStatus | ( | returnValue | returnvalue, |
BooleanType | doPrintStatus = BT_FALSE |
||
) |
Converts a returnValue from an (S)QProblem(B) object into a more simple status flag.
returnvalue | ReturnValue to be analysed. |
doPrintStatus | Flag indicating whether simple status shall be printed to screen. |
Definition at line 912 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue myPrintf | ( | const char * | s | ) |
Prints a string to desired output target (useful also for MATLAB output!).
s | String to be written. |
Definition at line 225 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue normaliseConstraints | ( | int_t | nV, |
int_t | nC, | ||
real_t * | A, | ||
real_t * | lbA, | ||
real_t * | ubA, | ||
int_t | type = 1 |
||
) |
Normalises QP constraints.
nV | Number of variables. |
nC | Number of constraints. |
A | Input: Constraint matrix, Output: Normalised constraint matrix. |
lbA | Input: Constraints' lower bound vector, Output: Normalised constraints' lower bound vector. |
ubA | Input: Constraints' upper bound vector, Output: Normalised constraints' upper bound vector. |
type | Norm type, 1: one-norm, 2: Euclidean norm. |
Definition at line 963 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
BEGIN_NAMESPACE_QPOASES returnValue print | ( | const real_t *const | v, |
int | n, | ||
const char * | name | ||
) |
Prints a named vector.
v | Vector to be printed. |
n | Length of vector. |
name | Name of vector. |
Definition at line 76 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue print | ( | const real_t *const | v, |
int_t | n, | ||
const int_t *const | V_idx, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) permuted vector.
v | Vector to be printed. |
n | Length of vector. |
V_idx | Pemutation vector. |
name | Name of vector. |
Definition at line 107 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue print | ( | const real_t *const | M, |
int | nrow, | ||
int | ncol, | ||
const char * | name | ||
) |
Prints a named matrix.
M | Matrix to be printed. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
name | Name of matrix. |
Definition at line 138 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue print | ( | const real_t *const | M, |
int_t | nrow, | ||
int_t | ncol, | ||
const int_t *const | ROW_idx, | ||
const int_t *const | COL_idx, | ||
const char * | name = 0 |
||
) |
Prints a (possibly named) permuted matrix.
M | Matrix to be printed. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
ROW_idx | Row pemutation vector. |
COL_idx | Column pemutation vector. |
name | Name of matrix. |
Definition at line 166 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue print | ( | const int *const | index, |
int | n, | ||
const char * | name | ||
) |
Prints a named index array.
index | Index array to be printed. |
n | Length of index array. |
name | Name of index array. |
Definition at line 194 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue printCopyrightNotice | ( | ) |
Prints qpOASES copyright notice.
Definition at line 255 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue readFromFile | ( | real_t * | data, |
int | nrow, | ||
int | ncol, | ||
const char * | datafilename | ||
) |
Reads a real_t matrix from file.
data | Matrix to be read from file. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
datafilename | Data file name. |
Definition at line 273 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue readFromFile | ( | real_t * | data, |
int | n, | ||
const char * | datafilename | ||
) |
Reads a real_t vector from file.
data | Vector to be read from file. |
n | Length of vector. |
datafilename | Data file name. |
Definition at line 327 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue readFromFile | ( | int * | data, |
int | n, | ||
const char * | datafilename | ||
) |
Reads an integer (column) vector from file.
data | Vector to be read from file. |
n | Length of vector. |
datafilename | Data file name. |
Definition at line 339 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue writeIntoFile | ( | const real_t *const | data, |
int | nrow, | ||
int | ncol, | ||
const char * | datafilename, | ||
BooleanType | append | ||
) |
Writes a real_t matrix into a file.
data | Matrix to be written into file. |
nrow | Row number of matrix. |
ncol | Column number of matrix. |
datafilename | Data file name. |
append | Indicates if data shall be appended if the file already exists (otherwise it is overwritten). |
Definition at line 388 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue writeIntoFile | ( | const real_t *const | data, |
int | n, | ||
const char * | datafilename, | ||
BooleanType | append | ||
) |
Writes a real_t vector into a file.
data | Vector to be written into file. |
n | Length of vector. |
datafilename | Data file name. |
append | Indicates if data shall be appended if the file already exists (otherwise it is overwritten). |
Definition at line 444 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue writeIntoFile | ( | const int *const | integer, |
int | n, | ||
const char * | datafilename, | ||
BooleanType | append | ||
) |
Writes an integer (column) vector into a file.
integer | Integer vector to be written into file. |
n | Length of vector. |
datafilename | Data file name. |
append | Indicates if integer shall be appended if the file already exists (otherwise it is overwritten). |
Definition at line 455 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue writeIntoMatFile | ( | FILE *const | matFile, |
const real_t *const | data, | ||
int_t | nRows, | ||
int_t | nCols, | ||
const char * | name | ||
) |
Writes a real_t matrix/vector into a Matlab binary file.
matFile | Pointer to Matlab binary file. |
data | Data to be written into file. |
nRows | Row number of matrix. |
nCols | Column number of matrix. |
name | Matlab name of matrix/vector to be stored. |
Definition at line 507 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.
returnValue writeIntoMatFile | ( | FILE *const | matFile, |
const int_t *const | data, | ||
int_t | nRows, | ||
int_t | nCols, | ||
const char * | name | ||
) |
Writes in integer matrix/vector into a Matlab binary file.
matFile | Pointer to Matlab binary file. |
data | Data to be written into file. |
nRows | Row number of matrix. |
nCols | Column number of matrix. |
name | Matlab name of matrix/vector to be stored. |
Definition at line 559 of file external_packages/qpOASES-3.2.0/src/Utils.cpp.