8 #define DSDPCHKCONEERR(a,b); { if (b){ DSDPSETERR1(b,"Cone Number: %d,\n",a);} }
10 static int ConeSetup=0,ConeComputeS=0,ConeComputeSS=0,ConeComputeH=0,ConeHMultiplyAdd=0,ConeMaxPStep=0,ConeMaxDStep=0,ConePotential=0,ConeComputeX=0,ConeView=0,ConeDestroy=0,ConeXEigs=0,ConeRHS=0,ConeInvertS=0;
11 static int DSDPRegisterConeEvents(
void);
19 #define __FUNCT__ "DSDPZeroConeEvents"
20 static int DSDPZeroConeEvents(){
22 ConeSetup=0;ConeComputeS=0;ConeComputeSS=0;ConeComputeH=0;ConeHMultiplyAdd=0;ConeMaxPStep=0;ConeMaxDStep=0;ConePotential=0;ConeComputeX=0;ConeView=0;ConeDestroy=0;ConeXEigs=0;ConeRHS=0;ConeInvertS=0;
23 DSDPFunctionReturn(0);
27 #define __FUNCT__ "DSDPRegisterConeEvents"
28 static int DSDPRegisterConeEvents(){
31 DSDPEventLogRegister(
"Cone Setup 1&2",&ConeSetup);
32 DSDPEventLogRegister(
"Cone Invert S",&ConeInvertS);
33 DSDPEventLogRegister(
"Cone RHS",&ConeRHS);
34 DSDPEventLogRegister(
"Cone Compute Newton Eq.",&ConeComputeH);
35 DSDPEventLogRegister(
"Cone Newton Multiply-Add",&ConeHMultiplyAdd);
36 DSDPEventLogRegister(
"Cone Max P Step Length",&ConeMaxPStep);
37 DSDPEventLogRegister(
"Cone Compute and Factor SP",&ConeComputeSS);
38 DSDPEventLogRegister(
"Cone Max D Step Length",&ConeMaxDStep);
39 DSDPEventLogRegister(
"Cone Compute and Factor S",&ConeComputeS);
40 DSDPEventLogRegister(
"Cone Potential",&ConePotential);
41 DSDPEventLogRegister(
"Cone View",&ConeView);
42 DSDPEventLogRegister(
"Cone Compute X",&ConeComputeX);
43 DSDPEventLogRegister(
"Cone X Residuals",&ConeXEigs);
44 DSDPEventLogRegister(
"Cone Destroy",&ConeDestroy);
46 DSDPFunctionReturn(0);
57 #define __FUNCT__ "DSDPSetUpCones"
62 info=DSDPRegisterConeEvents();
63 DSDPEventLogBegin(ConeSetup);
64 for (kk=0;kk<dsdp->ncones;kk++){
65 DSDPEventLogBegin(dsdp->K[kk].coneid);
66 info=
DSDPConeSetUp(dsdp->K[kk].cone,yy0);DSDPCHKCONEERR(kk,info);
67 DSDPEventLogEnd(dsdp->K[kk].coneid);
69 DSDPEventLogEnd(ConeSetup);
70 DSDPFunctionReturn(0);
83 #define __FUNCT__ "DSDPSetUpCones2"
87 DSDPEventLogBegin(ConeSetup);
88 for (kk=0;kk<dsdp->ncones;kk++){
89 DSDPEventLogBegin(dsdp->K[kk].coneid);
90 info=
DSDPConeSetUp2(dsdp->K[kk].cone,yy0,M);DSDPCHKCONEERR(kk,info);
91 DSDPEventLogEnd(dsdp->K[kk].coneid);
93 DSDPEventLogEnd(ConeSetup);
94 DSDPFunctionReturn(0);
106 #define __FUNCT__ "DSDPDestroyCones"
108 int info,kk,ncones=dsdp->ncones;
110 DSDPEventLogBegin(ConeDestroy);
111 for (kk=ncones-1;kk>=0; kk--){
112 DSDPEventLogBegin(dsdp->K[kk].coneid);
114 DSDPEventLogEnd(dsdp->K[kk].coneid);
118 if (dsdp->maxcones>0){
119 DSDPFREE(&dsdp->K,&info);DSDPCHKERR(info);
123 DSDPEventLogEnd(ConeDestroy);
124 info=DSDPZeroConeEvents();DSDPCHKERR(info);
125 DSDPFunctionReturn(0);
141 #define __FUNCT__ "DSDPComputeHessian"
143 int info,kk;
double r;
145 DSDPEventLogBegin(ConeComputeH);
146 dsdp->schurmu=dsdp->mutarget;
147 info=DSDPVecGetR(dsdp->y,&r);DSDPCHKERR(info);
150 info=DSDPVecZero(vrhs1);DSDPCHKERR(info);
151 info=DSDPVecZero(vrhs2);DSDPCHKERR(info);
152 info=DSDPVecZero(M.schur->rhs3);DSDPCHKERR(info);
154 for (kk=dsdp->ncones-1;kk>=0;kk--){
155 DSDPEventLogBegin(dsdp->K[kk].coneid);
157 DSDPEventLogEnd(dsdp->K[kk].coneid);
164 if (0 && dsdp->UsePenalty==DSDPNever){
165 info=DSDPVecAXPY(1.0,M.schur->rhs3,vrhs2);DSDPCHKERR(info);
166 info=DSDPVecZero(M.schur->rhs3);DSDPCHKERR(info);
167 info=DSDPVecZero(M.schur->dy3);DSDPCHKERR(info);
168 info=DSDPVecSetR(vrhs1,0);DSDPCHKERR(info);
169 info=DSDPVecSetR(vrhs2,r);DSDPCHKERR(info);
171 DSDPEventLogEnd(ConeComputeH);
172 DSDPFunctionReturn(0);
177 #define __FUNCT__ "DSDPHessianMultiplyAdd"
192 DSDPEventLogBegin(ConeHMultiplyAdd);
195 for (kk=0;kk<dsdp->ncones;kk++){
196 DSDPEventLogBegin(dsdp->K[kk].coneid);
197 info=
DSDPConeMultiplyAdd(dsdp->K[kk].cone,dsdp->schurmu,vrow,v,vv);DSDPCHKCONEERR(kk,info);
198 DSDPEventLogEnd(dsdp->K[kk].coneid);
201 DSDPEventLogEnd(ConeHMultiplyAdd);
202 DSDPFunctionReturn(0);
206 #define __FUNCT__ "DSDPComputeG"
216 int info,kk;
double r;
218 DSDPEventLogBegin(ConeRHS);
219 info=DSDPVecZero(vrhs1);DSDPCHKERR(info);
220 info=DSDPVecZero(vrhs2);DSDPCHKERR(info);
221 info=DSDPVecGetR(dsdp->y,&r);DSDPCHKERR(info);
225 if (0 && r==0){info=DSDPVecSetR(vrhs1,0);info=DSDPVecSetR(vrhs2,0);}
227 for (kk=0;kk<dsdp->ncones;kk++){
228 DSDPEventLogBegin(dsdp->K[kk].coneid);
229 info=
DSDPConeComputeRHS(dsdp->K[kk].cone,dsdp->schurmu,vt,vrhs1,vrhs2);DSDPCHKCONEERR(kk,info);
230 DSDPEventLogEnd(dsdp->K[kk].coneid);
232 DSDPEventLogEnd(ConeRHS);
235 DSDPFunctionReturn(0);
239 #define __FUNCT__ "DSDPComputeANorm2"
249 for (kk=0;kk<dsdp->ncones;kk++){
250 DSDPEventLogBegin(dsdp->K[kk].coneid);
251 info=
DSDPConeANorm2(dsdp->K[kk].cone,Anorm2);DSDPCHKCONEERR(kk,info);
252 DSDPEventLogEnd(dsdp->K[kk].coneid);
254 DSDPFunctionReturn(0);
271 #define __FUNCT__ "DSDPComputeSS"
277 DSDPEventLogBegin(ConeComputeS);
279 DSDPEventLogBegin(ConeComputeSS);
281 for (kk=dsdp->ncones-1; kk>=0 && psd==
DSDP_TRUE;kk--){
282 DSDPEventLogBegin(dsdp->K[kk].coneid);
283 info=
DSDPConeComputeS(dsdp->K[kk].cone,Y,flag,&psd); DSDPCHKCONEERR(kk,info);
284 DSDPEventLogEnd(dsdp->K[kk].coneid);
288 DSDPEventLogEnd(ConeComputeS);
290 DSDPEventLogEnd(ConeComputeSS);
292 DSDPFunctionReturn(0);
306 #define __FUNCT__ "DSDPInvertS"
310 DSDPEventLogBegin(ConeInvertS);
311 for (kk=0;kk<dsdp->ncones;kk++){
312 DSDPEventLogBegin(dsdp->K[kk].coneid);
314 DSDPEventLogEnd(dsdp->K[kk].coneid);
316 DSDPEventLogEnd(ConeInvertS);
317 DSDPFunctionReturn(0);
335 #define __FUNCT__ "DSDPComputeMaxStepLength"
338 double msteplength=1.0e30,conesteplength;
341 DSDPEventLogBegin(ConeMaxDStep);
343 DSDPEventLogBegin(ConeMaxPStep);
345 for (kk=0;kk<dsdp->ncones;kk++){
346 DSDPEventLogBegin(dsdp->K[kk].coneid);
347 conesteplength=1.0e20;
349 msteplength=DSDPMin(msteplength,conesteplength);
350 DSDPEventLogEnd(dsdp->K[kk].coneid);
352 *maxsteplength=msteplength;
354 DSDPEventLogEnd(ConeMaxDStep);
356 DSDPEventLogEnd(ConeMaxPStep);
358 DSDPFunctionReturn(0);
377 #define __FUNCT__ "DSDPPassXVectors"
381 for (kk=0;kk<dsdp->ncones;kk++){
382 DSDPEventLogBegin(dsdp->K[kk].coneid);
384 DSDPEventLogEnd(dsdp->K[kk].coneid);
386 DSDPFunctionReturn(0);
400 #define __FUNCT__ "DSDPGetConicDimension"
405 for (kk=0;kk<dsdp->ncones;kk++){
411 DSDPFunctionReturn(0);
423 #define __FUNCT__ "DSDPViewCones"
427 DSDPEventLogBegin(ConeView);
428 for (kk=0;kk<dsdp->ncones;kk++){
429 DSDPEventLogBegin(dsdp->K[kk].coneid);
430 info=
DSDPConeView(dsdp->K[kk].cone);DSDPCHKCONEERR(kk,info);
431 DSDPEventLogEnd(dsdp->K[kk].coneid);
433 DSDPEventLogEnd(ConeView);
434 DSDPFunctionReturn(0);
449 #define __FUNCT__ "DSDPMonitorCones"
453 DSDPEventLogBegin(ConeView);
454 for (kk=0;kk<dsdp->ncones;kk++){
455 DSDPEventLogBegin(dsdp->K[kk].coneid);
457 DSDPEventLogEnd(dsdp->K[kk].coneid);
459 DSDPEventLogEnd(ConeView);
460 DSDPFunctionReturn(0);
473 #define __FUNCT__ "DSDPSparsityInSchurMat"
477 for (kk=0;kk<dsdp->ncones;kk++){
482 DSDPFunctionReturn(0);
494 #define __FUNCT__ "DSDPComputeLogSDeterminant"
497 double coneobjective,conepotential,llogdet=0;
499 DSDPEventLogBegin(ConePotential);
500 for (kk=0;kk<dsdp->ncones;kk++){
501 DSDPEventLogBegin(dsdp->K[kk].coneid);
502 coneobjective=0;conepotential=0;
504 llogdet+=conepotential;
505 DSDPEventLogEnd(dsdp->K[kk].coneid);
508 DSDPEventLogEnd(ConePotential);
509 DSDPFunctionReturn(0);
521 #define __FUNCT__ "DSDPSetCone"
527 if (dsdp->ncones>=dsdp->maxcones){
528 tc=2*dsdp->maxcones+4;
530 DSDPCALLOC2(&ccones,DCone,tc,&info);DSDPCHKERR(info);
531 for (i=0;i<dsdp->ncones;i++){ccones[i].cone=dsdp->K[i].cone;}
532 for (i=0;i<dsdp->ncones;i++){ccones[i].coneid=dsdp->K[i].coneid;}
533 DSDPFREE(&dsdp->K,&info);DSDPCHKERR(info);
538 DSDPEventLogRegister(conename,&tc);
539 dsdp->K[dsdp->ncones].cone=tcone;
540 dsdp->K[dsdp->ncones].coneid=tc;
542 DSDPFunctionReturn(0);
568 #define __FUNCT__ "DSDPAddCone"
574 info=DSDPConeSetData(&K,dsdpops,dsdpcone); DSDPCHKERR(info);
576 DSDPFunctionReturn(0);
601 #define __FUNCT__ "DSDPSetSchurMatOps"
605 info=DSDPSchurMatSetData(&dsdp->M,sops,mdata);DSDPCHKERR(info);
606 DSDPFunctionReturn(0);
621 #define __FUNCT__ "DSDPSetSchurRow"
626 DSDPFunctionReturn(0);
653 #define __FUNCT__ "DSDPComputeXVariables"
656 double ttracexs=0,tttracexs=0,tracex;
659 DSDPEventLogBegin(ConeComputeX);
660 info=DSDPVecZero(AX);DSDPCHKERR(info);
661 for (kk=0;kk<dsdp->ncones;kk++){
662 DSDPEventLogBegin(dsdp->K[kk].coneid);
664 info=
DSDPConeComputeX(dsdp->K[kk].cone,xmakermu,xmakery,xmakerdy,AX,&tttracexs);DSDPCHKCONEERR(kk,info);
666 DSDPEventLogEnd(dsdp->K[kk].coneid);
668 info=DSDPVecGetR(AX,&tracex); DSDPCHKERR(info);
669 DSDPLogInfo(0,2,
"Trace(X): %4.2e\n",dsdp->tracex);
670 info=DSDPVecAXPY(-1.0,dsdp->b,AX); DSDPCHKERR(info);
671 info=DSDPComputeFixedYX(dsdp->M,AX); DSDPCHKERR(info);
673 info=DSDPVecSetR(AX,tracex); DSDPCHKERR(info);
674 DSDPEventLogEnd(ConeComputeX);
675 DSDPFunctionReturn(0);