Skip to content

Commit

Permalink
Fix compiler warnings about uninitialised variables and #15
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgj committed Aug 15, 2020
1 parent fedd22a commit 313c7d2
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion blkchol2.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void cholonBlk(double *x, double *d, mwIndex m, const mwIndex ncols, const mwInd
------------------------------------------------------- */
xkk = x[inz];
if(xkk > lb[k]){ /* now xkk > 0 */
if(xkk < ub){
if((m>1) && (xkk < ub)){
ubk = maxabs(x+inz+1,m-1) / maxu;
if(xkk < ubk){
/* ------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion bwblkslv.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void mexFunction(const int nlhs, mxArray *plhs[],
mwIndex m,n, j, k, nsuper, inz;
double *y, *fwork;
const double *permPr, *b, *xsuperPr;
const mwIndex *yjc, *yir, *bjc, *bir;
const mwIndex *yjc=NULL, *yir=NULL, *bjc=NULL, *bir=NULL;
mwIndex *perm, *xsuper, *iwork, *snode;
jcir L;
char bissparse;
Expand Down
2 changes: 1 addition & 1 deletion dpr1fact.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ char dodpr1fact(double *beta, mwIndex *perm, double *d, double t, const double *
------------------------------------------------------------ */
else{
psqrdep = 0.0;
for(i = 0; dep[i] < m; i++)
for(i = 0, j = 0; dep[i] < m; i++)
if(psqr[dep[i]] > psqrdep){
j = i;
psqrdep = psqr[dep[i]];
Expand Down
2 changes: 1 addition & 1 deletion extractA.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
jcir At, Apart;
mwIndex i, m, njc, ifirst, n, ynnz, blk0,blk1;
mwIndex i, m, njc, ifirst=0, n=0, ynnz, blk0, blk1;
mwIndex *Ajc;
const double *blkstartPr, *AjcPr;
bool isblk0negative;
Expand Down
2 changes: 1 addition & 1 deletion fwblkslv.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void mexFunction(const int nlhs, mxArray *plhs[],
mwIndex m,n, j, k, nsuper, inz;
double *y,*fwork;
const double *permPr, *b, *xsuperPr;
const mwIndex *yjc, *yir, *bjc, *bir;
const mwIndex *yjc=NULL, *yir=NULL, *bjc=NULL, *bir=NULL;
mwIndex *perm, *invperm, *snode, *xsuper, *iwork;
jcir L;
char bissparse;
Expand Down
4 changes: 4 additions & 0 deletions install_sedumi.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ function install_sedumi( varargin )
% whereas calling '-O' would result in gcc '-O1'.
flags{end+1} = '-O2';
flags{end+1} = '-DOCTAVE';
flags{end+1} = '-Werror';
flags{end+1} = '-Wall';
flags{end+1} = '-Wno-unused-variable';
flags{end+1} = '-Wno-unused-but-set-variable';
if (ismac ())
% Assume Homebrew (https://brew.sh/) installation.
% https://stackoverflow.com/questions/50634727/dyld-library-not-loaded-usr-local-opt-openblas-lib-libopenblasp-r0-2-20-dylib
Expand Down
2 changes: 1 addition & 1 deletion sedumi.m
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@
info.err(4)=0;
end
% Dual infeasibility
%info.err(3)=0.0; %s is not maintained explicitely
info.err(3)=0.0; %s is not maintained explicitely
% Relative duality gap
info.err(5)=(cx-by)/(1+abs(cx)+abs(by));
% Relative complementarity
Expand Down
8 changes: 6 additions & 2 deletions spscale.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ mwIndex realdmulx(double *y, mwIndex *ycols, const double *d,
{
mwIndex knz, jfirst, jlast, inz, i, j;
knz = 0; /* length(ycols) */
jfirst = 0;
jlast = 0; /* index right after last activated column */
y -= n; /* point to dummy column, which will be skipped */
/* ------------------------------------------------------------
Expand Down Expand Up @@ -133,6 +134,7 @@ mwIndex cpxdmulx(double *y, mwIndex *ycols, const double *d,
const double *dpi;
char found;
knz = 0; /* length(ycols) */
jfirst = 0;
jlast = 0; /* index right after last activated column */
nsqr = SQR(n);
dpi = d + nsqr;
Expand Down Expand Up @@ -251,7 +253,7 @@ void sprealdxd(double *z, const mwIndex *zir, const mwIndex znnz,
{
mwIndex inz, i, icol, j, jfirst, jlast, m;
double *xd;
const double *dj, *xdj;
const double *dj=NULL, *xdj=NULL;
/* ------------------------------------------------------------
Partition 2*n^2 WORKING array fwork into [fwork(n^2), xd(n^2)].
------------------------------------------------------------ */
Expand All @@ -276,6 +278,7 @@ void sprealdxd(double *z, const mwIndex *zir, const mwIndex znnz,
zij = (D*sym(X)*D)_ij = [ DXD_ij + DXD_ji ] /2.
Note that DXD_ij = xd(:,i)' * fwork(:,j). (m mults)
------------------------------------------------------------ */
jfirst = 0;
jlast = 0; /* index right after last activated column */
for(inz = 0; inz < znnz; inz++){
if((i = zir[inz]) >= jlast){ /* move to new z-column */
Expand Down Expand Up @@ -334,7 +337,8 @@ void spcpxdxd(double *z, const mwIndex *zir, const mwIndex znnz,
mwIndex inz, i, icol, j, jfirst, jlast, m, nsqr, imgfirst;
double *dx, *dxpi, *fworkpi;
double zi;
const double *dj, *djpi, *djx, *djxpi;
const double *dj=NULL, *djpi=NULL, *djx=NULL, *djxpi=NULL;
jfirst = 0;
nsqr = SQR(n);
/* ------------------------------------------------------------
Partition 4*n^2 WORKING array fwork into [fwork(2*n^2), dxRows(2*n^2)].
Expand Down
4 changes: 3 additions & 1 deletion urotorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void rotorder(mwIndex *perm, double *u, mwIndex *gjc, twodouble *g, double *d,
------------------------------------------------------------ */
for(j = 0; j < n; j++)
perm[j] = j;
pivk = 0;
inz = 0;
d[0] = 0.0; h = 1.0;
for(k = 0, rowuk = u; k < n-1; k++, rowuk++){
Expand Down Expand Up @@ -208,6 +209,7 @@ void prpirotorder(mwIndex *perm, double *u,double *upi, mwIndex *gjc,
------------------------------------------------------------ */
for(j = 0; j < n; j++)
perm[j] = j;
pivk = 0;
inz = 0;
d[0] = 0.0; h = 1.0;
for(k = 0, rowuk = u, rowukpi = upi; k < n-1; k++, rowuk++, rowukpi++){
Expand Down Expand Up @@ -312,7 +314,7 @@ void mexFunction(const int nlhs, mxArray *plhs[],
{
mxArray *myplhs[NPAROUT];
mwIndex i,j,k, nk, nksqr, lenud, sdplen, gnnz, inz, maxKs,maxKssqr, rgnnz, hgnnz;
const double *uOld, *permOld;
const double *uOld, *permOld=NULL;
double *u, *d, *gjcPr, *permPr, *fwork, *fworkpi;
mwIndex *perm, *gjc;
double *g, *gk;
Expand Down

0 comments on commit 313c7d2

Please sign in to comment.