11 #define DSDPNoOperationError(a); { DSDPSETERR1(10,"Schur matrix type: %s, Operation not defined\n",(a).dsdpops->matname); } 12 #define DSDPChkMatError(a,b); { if (b){ DSDPSETERR1(b,"Schur matrix type: %s,\n",(a).dsdpops->matname);} } 16 #define __FUNCT__ "DSDPSchurMatRowColumnScaling" 35 double *cols,r=M.schur->r;
38 info=DSDPVecSet(0.0,V);DSDPCHKERR(info);
39 info=DSDPVecGetSize(V,&m);DSDPCHKERR(info);
40 if (row==0){info=DSDPVecZero(V);DSDPCHKERR(info);*nzcols=0;}
42 info=DSDPVecZero(V);DSDPCHKERR(info);*nzcols=0;
43 if (r){info=DSDPVecSetR(V,1.0);DSDPCHKERR(info);*nzcols=1;}
44 }
else if (M.dsdpops->matrownonzeros){
45 info=DSDPVecGetSize(V,&m);DSDPCHKERR(info);
46 info=DSDPVecGetArray(V,&cols);DSDPCHKERR(info);
47 info=(M.dsdpops->matrownonzeros)(M.data,row-1,cols+1,nzcols,m-2); DSDPChkMatError(M,info);
48 info=DSDPVecRestoreArray(V,&cols);DSDPCHKERR(info);
49 info=DSDPZeroFixedVariables(M,V);DSDPCHKERR(info);
50 info=DSDPVecSetC(V,0.0);DSDPCHKERR(info);
51 if (r){info=DSDPVecSetR(V,1.0);DSDPCHKERR(info);}
52 info=DSDPIsFixed(M,row,&flag);DSDPCHKERR(info);
53 if (flag==
DSDP_TRUE&&*nzcols>0){info=DSDPVecZero(V);*nzcols=0;DSDPFunctionReturn(0);}
55 DSDPNoOperationError(M);
58 DSDPFunctionReturn(0);
62 #define __FUNCT__ "DSDPSchurMatAddRow" 78 double *v,rr,dd=1e-1*M.schur->dd;
82 info=DSDPVecGetSize(R,&m); DSDPCHKERR(info);
85 info=DSDPVecGetR(R,&rr);DSDPCHKERR(info);
86 info=DSDPVecAddR(rhs3,alpha*rr);DSDPCHKERR(info);
87 }
else if (M.dsdpops->mataddrow){
88 info=DSDPVecGetArray(R,&v); DSDPCHKERR(info);
90 for (j=0;j<m;j++){
if (fabs(v[j]) < 1e-25 && row!=j){ v[j]=0.0;} }
92 info=DSDPZeroFixedVariables(M,R);DSDPCHKERR(info);
93 info=DSDPIsFixed(M,row,&flag);DSDPCHKERR(info);
94 if (flag==
DSDP_TRUE){info=DSDPVecSetBasis(R,row);DSDPCHKERR(info);}
95 info=(M.dsdpops->mataddrow)(M.data,row-1,alpha,v+1,m-2); DSDPChkMatError(M,info);
96 info=DSDPVecRestoreArray(R,&v); DSDPCHKERR(info);
97 info=DSDPVecGetR(R,&rr); DSDPCHKERR(info);
98 info=DSDPVecAddElement(rhs3,row,alpha*rr); DSDPCHKERR(info);
100 DSDPNoOperationError(M);
102 DSDPFunctionReturn(0);
106 #define __FUNCT__ "DSDPSchurMatVariableCompute" 125 info=DSDPVecGetSize(M.schur->rhs3,&m);
126 if (row==0){ *rcv=0.0;
127 }
else if (row==m-1){
130 }
else if (M.dsdpops->pmatonprocessor){
131 info=(M.dsdpops->pmatonprocessor)(M.data,row-1,&dd); DSDPChkMatError(M,info);
132 if (dd){*rcv=1.0;}
else {*rcv=0;}
137 DSDPNoOperationError(M);
140 DSDPFunctionReturn(0);
144 #define __FUNCT__ "DSDPSchurMatAddDiagonalElement" 161 info=DSDPVecGetSize(rhs3,&m);DSDPCHKERR(info);
164 }
else if (row==m-1){info=DSDPVecAddR(rhs3,dd);
165 }
else if (M.dsdpops->mataddelement){
166 info=(M.dsdpops->mataddelement)(M.data,row-1,dd); DSDPChkMatError(M,info);
168 DSDPNoOperationError(M);
170 DSDPFunctionReturn(0);
174 #define __FUNCT__ "DSDPSchurMatVariableComputeR" 184 if (M.schur->r) *rcv=1.0;
185 DSDPFunctionReturn(0);
190 #define __FUNCT__ "DSDPSchurMatAddR" 201 if (dd==0){DSDPFunctionReturn(0);}
202 info=DSDPVecAddElement(M.schur->rhs3,row,dd);DSDPCHKERR(info);
203 DSDPFunctionReturn(0);
207 #define __FUNCT__ "DSDPSchurMatVariableComputeC" 208 int DSDPSchurMatVariableComputeC(
DSDPSchurMat M,
double *rcv){
211 DSDPFunctionReturn(0);
215 #define __FUNCT__ "DSDPSchurMatAddC" 216 int DSDPSchurMatAddC(
DSDPSchurMat M,
int row,
double dd){
218 DSDPFunctionReturn(0);
222 #define __FUNCT__ "DSDPSchurMatDiagonalScaling" 240 info=DSDPVecSet(1.0,D);DSDPCHKERR(info);
241 info=DSDPVecGetSize(D,&m);DSDPCHKERR(info);
242 if (M.dsdpops->pmatlocalvariables){
243 info=DSDPVecGetArray(D,&vars);DSDPCHKERR(info);
244 info=(M.dsdpops->pmatlocalvariables)(M.data,vars+1,m-2); DSDPChkMatError(M,info);
245 info=DSDPVecRestoreArray(D,&vars);DSDPCHKERR(info);
249 DSDPNoOperationError(M);
252 info=DSDPVecSetC(D,0.0);DSDPCHKERR(info);
253 if (M.schur->r==0){info=DSDPVecSetR(D,0.0);DSDPCHKERR(info);}
254 info=DSDPZeroFixedVariables(M,D);DSDPCHKERR(info);
255 DSDPFunctionReturn(0);
259 #define __FUNCT__ "DSDPSchurMatAddDiagonal" 276 if (M.dsdpops->matadddiagonal){
277 info=DSDPZeroFixedVariables(M,D);DSDPCHKERR(info);
278 info=DSDPVecGetSize(D,&m); DSDPCHKERR(info);
279 info=DSDPVecGetArray(D,&dd); DSDPCHKERR(info);
280 info=(M.dsdpops->matadddiagonal)(M.data,dd+1,m-2); DSDPChkMatError(M,info);
281 info=DSDPVecAddR(M.schur->rhs3,dd[m-1]);DSDPCHKERR(info);
282 info=DSDPVecRestoreArray(D,&dd); DSDPCHKERR(info);
284 DSDPNoOperationError(M);
286 DSDPFunctionReturn(0);
DSDPTruth
Boolean variables.
int DSDPSchurMatAddRow(DSDPSchurMat M, int row, double alpha, DSDPVec R)
Add elements to a row of the Schur matrix.
struct DSDPVec_C DSDPVec
This object hold m+2 variables: a scaling of C, the y variables, and r.
int DSDPSchurMatAddR(DSDPSchurMat M, int row, double dd)
Add an element to the Schur matrix correponding the variable r.
Schur complement matrix whose solution is the Newton direction.
Error handling, printing, and profiling.
int DSDPSchurMatAddDiagonalElement(DSDPSchurMat M, int row, double dd)
Determine with the cone should compute this diagonal element of M and RHS.
Function pointers that a Schur complement matrix (dense, sparse, parallel dense) must provide...
int DSDPSchurMatRowColumnScaling(DSDPSchurMat M, int row, DSDPVec V, int *nzcols)
Get the scaling and nonzero pattern of each column in this row of the matrix.
Solver, solution types, termination codes,.
Methods of a Schur Matrix.
int DSDPSchurMatVariableCompute(DSDPSchurMat M, int row, double *rcv)
Determine with the cone should compute this diagonal element of M and RHS.
int DSDPSchurMatAddDiagonal(DSDPSchurMat M, DSDPVec D)
Add elements to a row of the Schur matrix.
int DSDPSchurMatInParallel(DSDPSchurMat M, DSDPTruth *flag)
Determine whether M is computed in parallel.
int DSDPSchurMatVariableComputeR(DSDPSchurMat M, double *rcv)
Add an element to the Schur matrix correponding the variable r.
int DSDPSchurMatDiagonalScaling(DSDPSchurMat M, DSDPVec D)
Get the scaling and nonzero pattern of each diagonal element of the matrix.