qpSWIFT
A Sparse Quadratic Programming Solver
|
Go to the documentation of this file. 1 #ifndef __QP_AUXILARY_H__
2 #define __QP_AUXILARY_H__
11 #include "amd_internal.h"
160 void SparseMatrixSetup(qp_int m, qp_int n, qp_int nnz, qp_int *jc, qp_int *ir, qp_real *pr,
smat *sparse);
162 void Transpose_Row_Count(qp_int m, qp_int n, qp_int *Li, qp_int *Lp, qp_int *Lti, qp_int *Ltp);
170 void form_ds(qp_real *ds, qp_real *lambda, qp_real *delta_s, qp_real *delta_z, qp_real sigma, qp_real mu, qp_int m, qp_int selector);
178 void updatekktmatrix(
smat *
kkt, qp_real *s, qp_real *z, qp_real *delta_s, qp_real *delta_z, qp_real alpha_p, qp_real alpha_d, qp_int m, qp_int n, qp_int p, qp_int indicator);
180 void updatekktmatrix_b(qp_real *b, qp_real *rx, qp_real *ry, qp_real *rz, qp_real *ds, qp_real *z, qp_int n, qp_int m, qp_int p);
182 qp_int
checksign(qp_real *s, qp_real *delta_s, qp_real alpha, qp_int count);
184 void updatevariables(qp_real *x, qp_real *delta_x, qp_real alpha, qp_int count);
186 void formlambda(qp_real *lambda, qp_real *s, qp_real *z, qp_int n);
188 qp_real
formrho(qp_real *s, qp_real *delta_s, qp_real *z, qp_real *delta_z, qp_real alpha_p, qp_real alpha_d, qp_int n);
192 void test_reach(qp_int *Parent, qp_int *Pinv, qp_int *UPattern, qp_int n, qp_int m, qp_int p);
194 void findsteplength(qp_real *s, qp_real *delta_s, qp_real *z, qp_real *delta_z, qp_int m, qp_real *alpha_p, qp_real *alpha_d);
196 qp_real
obj_value(
smat *P, qp_real *c, qp_real *x, qp_real *temp);
qp_real * pr
Definition: Auxilary.h:22
stats * stats
Definition: Auxilary.h:149
qp_real * h
Definition: Auxilary.h:140
void SparseMatrixSetup(qp_int m, qp_int n, qp_int nnz, qp_int *jc, qp_int *ir, qp_real *pr, smat *sparse)
Sets up the Sparse Matrix in Column Compressed Storage Format based on inputs.
Definition: Auxilary.c:660
qp_real * temp
Definition: Auxilary.h:135
qp_int * Pinv
Definition: Auxilary.h:48
void formkktmatrix_U(smat *P, smat *G, smat *Gt, smat *kkt)
Definition: Auxilary.c:14
qp_int * UPattern
Definition: Auxilary.h:43
smat * kktmatrix
Definition: Auxilary.h:33
qp_int * P
Definition: Auxilary.h:47
qp_real sigma
Definition: Auxilary.h:95
qp_real tsolve
Definition: Auxilary.h:60
void formkktmatrix_full(smat *P, smat *G, smat *A, smat *Gt, smat *At, smat *kktmatrix)
Assembles the KKT matrix.
Definition: Auxilary.c:71
qp_real n_rx
Definition: Auxilary.h:67
qp_int Flag
Definition: Auxilary.h:77
Definition: Auxilary.h:18
qp_real * delta
Definition: Auxilary.h:126
qp_real * delta_y
Definition: Auxilary.h:128
void updatekktmatrix_b(qp_real *b, qp_real *rx, qp_real *ry, qp_real *rz, qp_real *ds, qp_real *z, qp_int n, qp_int m, qp_int p)
Updates the right hand side of the KKT linear system of equations.
Definition: Auxilary.c:274
qp_int * Parent
Definition: Auxilary.h:35
qp_real obj_value(smat *P, qp_real *c, qp_real *x, qp_real *temp)
Computes the objective function value f = x'Px + c'x.
Definition: Auxilary.c:1133
qp_real * z
Definition: Auxilary.h:119
qp_int m
Definition: Auxilary.h:110
qp_real n_rz
Definition: Auxilary.h:69
qp_real tsetup
Definition: Auxilary.h:59
void form_ds(qp_real *ds, qp_real *lambda, qp_real *delta_s, qp_real *delta_z, qp_real sigma, qp_real mu, qp_int m, qp_int selector)
Updates the ds vector based on the selector.
Definition: Auxilary.c:315
qp_int * Pattern
Definition: Auxilary.h:42
qp_real kkt_time
Definition: Auxilary.h:61
void SparseMatrixTranspose(smat *A, smat *At)
Computes the sparse matrix transpose.
Definition: Auxilary.c:901
void SparseMatrixTransMultiply(smat *A, qp_real *x, qp_real *y, qp_int start)
Performs Sparse Matrix Transpose Vector Multiplication as.
Definition: Auxilary.c:802
qp_real fval
Definition: Auxilary.h:76
qp_real mu
Definition: Auxilary.h:114
qp_int checksign(qp_real *s, qp_real *delta_s, qp_real alpha, qp_int count)
Checks if x + alpha*delta_x < 0.
Definition: Auxilary.c:404
void Transpose_Row_Count(qp_int m, qp_int n, qp_int *Li, qp_int *Lp, qp_int *Lti, qp_int *Ltp)
Computes the ir and jc of transpose of a Matrix.
Definition: Auxilary.c:683
qp_real innerproduct(qp_real *x, qp_real *y, qp_int n)
Calculates the inner product of two vectors.
Definition: Auxilary.c:451
qp_real * b
Definition: Auxilary.h:142
smat * At
Definition: Auxilary.h:144
qp_real * s
Definition: Auxilary.h:120
void updatevariables(qp_real *x, qp_real *delta_x, qp_real alpha, qp_int count)
Performs scalar vector addition.
Definition: Auxilary.c:246
qp_int resolve_kkt
Definition: Auxilary.h:82
qp_real ldl_numeric
Definition: Auxilary.h:62
qp_real * delta_x
Definition: Auxilary.h:127
qp_int n
Definition: Auxilary.h:23
qp_int maxit
Definition: Auxilary.h:92
qp_int nnz
Definition: Auxilary.h:25
smat * G
Definition: Auxilary.h:139
qp_real * x
Definition: Auxilary.h:117
qp_real * ds
Definition: Auxilary.h:132
void computeresiduals(QP *myQP)
Computes the residuals rx, ry and rz.
Definition: Auxilary.c:745
qp_real rho
Definition: Auxilary.h:115
qp_int n
Definition: Auxilary.h:109
void test_reach(qp_int *Parent, qp_int *Pinv, qp_int *UPattern, qp_int n, qp_int m, qp_int p)
Computes the nodes to be updated at each iteration.
Definition: Auxilary.c:1104
qp_real alpha_d
Definition: Auxilary.h:73
qp_real sigma_d
Definition: Auxilary.h:113
qp_int * jc
Definition: Auxilary.h:20
qp_real * D
Definition: Auxilary.h:46
qp_real * delta_s
Definition: Auxilary.h:130
qp_int IterationCount
Definition: Auxilary.h:66
void densetosparse_ROWMAJOR(qp_int m, qp_int n, qp_real *pr, smat *A)
Converts dense matrix in row major format to CCS format.
Definition: Auxilary.c:1219
qp_real * Y
Definition: Auxilary.h:44
qp_real * y
Definition: Auxilary.h:118
void formlambda(qp_real *lambda, qp_real *s, qp_real *z, qp_int n)
Computes the scaling point lambda.
Definition: Auxilary.c:638
qp_int AMD_RESULT
Definition: Auxilary.h:78
Definition: Auxilary.h:89
kkt * kkt
Definition: Auxilary.h:147
void SparseMatrixMultiply(smat *A, qp_real *x, qp_real *y, qp_int start)
Performs Sparse Matrix Vector Multiplication as.
Definition: Auxilary.c:839
qp_real alpha_p
Definition: Auxilary.h:72
void updatekktmatrix(smat *kkt, qp_real *s, qp_real *z, qp_real *delta_s, qp_real *delta_z, qp_real alpha_p, qp_real alpha_d, qp_int m, qp_int n, qp_int p, qp_int indicator)
Updates the lower diagonal part of the kkt Matrix,.
Definition: Auxilary.c:205
qp_int m
Definition: Auxilary.h:24
Definition: Auxilary.h:55
qp_int * Lti
Definition: Auxilary.h:40
qp_real * lambda
Definition: Auxilary.h:133
qp_int * Li
Definition: Auxilary.h:38
void kktsolve_2(QP *myQP)
Solves the kktlinear system from results of kktsolve_1 and updates delta_x, delta_y,...
Definition: Auxilary.c:524
qp_int * ir
Definition: Auxilary.h:21
qp_real * rz
Definition: Auxilary.h:124
qp_int ldlinitialsolve(kkt *mykkt, qp_real *delta)
Solves the kkt linear system to find initial conditions.
Definition: Auxilary.c:578
void densetosparse(qp_int m, qp_int n, qp_real *pr, smat *A)
Converts dense matrix in column major format to CCS format.
Definition: Auxilary.c:1154
Definition: Auxilary.h:106
qp_real reltol
Definition: Auxilary.h:93
qp_int * Lp
Definition: Auxilary.h:39
qp_real n_ry
Definition: Auxilary.h:68
smat * Gt
Definition: Auxilary.h:145
void findsteplength(qp_real *s, qp_real *delta_s, qp_real *z, qp_real *delta_z, qp_int m, qp_real *alpha_p, qp_real *alpha_d)
Calculates the step length.
Definition: Auxilary.c:359
qp_int verbose
Definition: Auxilary.h:96
qp_int kkt_initialize(QP *myQP)
Computes the initial condition for the QP problem.
Definition: Auxilary.c:992
smat * P
Definition: Auxilary.h:137
qp_real * delta_z
Definition: Auxilary.h:129
qp_int p
Definition: Auxilary.h:111
qp_real * rx
Definition: Auxilary.h:122
qp_real * Lx
Definition: Auxilary.h:45
qp_int * Ltp
Definition: Auxilary.h:41
qp_int kktsolve_1(QP *myQP)
Solves the KKT linear systems and updates delta_z and delta_s.
Definition: Auxilary.c:471
qp_real * ry
Definition: Auxilary.h:123
qp_int * Flag
Definition: Auxilary.h:36
settings * options
Definition: Auxilary.h:148
Definition: Auxilary.h:31
qp_real * c
Definition: Auxilary.h:138
qp_real n_mu
Definition: Auxilary.h:70
qp_real * b
Definition: Auxilary.h:34
qp_real formrho(qp_real *s, qp_real *delta_s, qp_real *z, qp_real *delta_z, qp_real alpha_p, qp_real alpha_d, qp_int n)
Computes the scalar rho as.
Definition: Auxilary.c:879
qp_int * Lnz
Definition: Auxilary.h:37
qp_real abstol
Definition: Auxilary.h:94
smat * A
Definition: Auxilary.h:141