dbounds.c

Go to the documentation of this file.
00001 #include "dsdpcone_impl.h"
00002 #include "dsdpsys.h"
00003 #include "dsdp5.h"
00004 
00005 #define COMPUTEUBS(a,b,c)  (-(a)-(b)-(c))
00006 
00015 struct BCone_C{
00016   int keyid;
00017   int nn,nnmax;
00018   int *ib;
00019   double *u,*au,*us,*uss,*ux,*uds;
00020   double r,muscale;
00021   int m;
00022   double *xuout;
00023   DSDPVec WY,WY2;
00024 };
00025 
00026 #define BKEY  5432
00027 #define BConeValid(a) {if (!(a)||((a)->keyid!=BKEY)){ DSDPSETERR(101,"DSDPERROR: Invalid Bcone object\n");}}
00028 
00029 #undef __FUNCT__  
00030 #define __FUNCT__ "BConeSetUp"
00031 static int BConeSetup(void *dcone,DSDPVec y){
00032   BCone bcone=(BCone)dcone;
00033   int nn=bcone->nn;
00034   int info;
00035 
00036   DSDPFunctionBegin;
00037   if (bcone->nn<1) return 0;
00038   DSDPCALLOC2(&bcone->us,double,nn,&info);DSDPCHKERR(info);
00039   DSDPCALLOC2(&bcone->uss,double,nn,&info);DSDPCHKERR(info);
00040   DSDPCALLOC2(&bcone->ux,double,nn,&info);DSDPCHKERR(info);
00041   DSDPCALLOC2(&bcone->uds,double,nn,&info);DSDPCHKERR(info);
00042   DSDPFunctionReturn(0);
00043 }
00044 
00045 #undef __FUNCT__  
00046 #define __FUNCT__ "BConeSetUp2"
00047 static int BConeSetup2(void *dcone, DSDPVec Y, DSDPSchurMat M){
00048   int info;
00049   BCone bcone=(BCone)dcone;
00050   DSDPFunctionBegin;
00051   info=DSDPVecDuplicate(Y,&bcone->WY);DSDPCHKERR(info);
00052   info=DSDPVecDuplicate(Y,&bcone->WY2);DSDPCHKERR(info);
00053   DSDPFunctionReturn(0);
00054 }
00055 
00056 #undef __FUNCT__  
00057 #define __FUNCT__ "BConeDestroy"
00058 static int BConeDestroy(void *dcone){
00059   int info;
00060   BCone bcone=(BCone)dcone;
00061   DSDPFunctionBegin;
00062   DSDPFREE(&bcone->ib,&info);DSDPCHKERR(info);
00063   DSDPFREE(&bcone->u,&info);DSDPCHKERR(info);
00064   DSDPFREE(&bcone->au,&info);DSDPCHKERR(info);
00065   DSDPFREE(&bcone->us,&info);DSDPCHKERR(info);
00066   DSDPFREE(&bcone->uss,&info);DSDPCHKERR(info);
00067   DSDPFREE(&bcone->uds,&info);DSDPCHKERR(info);
00068   DSDPFREE(&bcone->ux,&info);DSDPCHKERR(info);
00069 
00070   info=DSDPVecDestroy(&bcone->WY);DSDPCHKERR(info);
00071   info=DSDPVecDestroy(&bcone->WY2);DSDPCHKERR(info);
00072 
00073   DSDPFREE(&dcone,&info);DSDPCHKERR(info);
00074   DSDPFunctionReturn(0);
00075 }
00076 
00077 #undef __FUNCT__  
00078 #define __FUNCT__ "BConeSize"
00079 static int BConeSize(void *dcone, double *n){
00080   BCone bcone=(BCone)dcone;
00081   DSDPFunctionBegin;
00082   *n=(double)(bcone->nn);
00083   DSDPFunctionReturn(0);
00084 }
00085 
00086 
00087 #undef __FUNCT__  
00088 #define __FUNCT__ "BConeComputeS"
00089 static int BConeComputeS(BCone bcone,DSDPVec Y,double ss[], int n){
00090   int i,ii,info;
00091   int *ib=bcone->ib, nn=bcone->nn;
00092   double cr,rr,r,yy,*au=bcone->au,*u=bcone->u;
00093 
00094   DSDPFunctionBegin;
00095   info=DSDPVecGetC(Y,&cr);
00096   info=DSDPVecGetR(Y,&rr);
00097   r=rr*bcone->r;
00098   for (i=0;i<nn;i++){
00099     ii=ib[i];
00100     info=DSDPVecGetElement(Y,ii,&yy);
00101     ss[i]=-cr*u[i]-au[i]*yy-r;
00102   }  
00103   DSDPFunctionReturn(0);
00104 }
00105 
00106 #undef __FUNCT__  
00107 #define __FUNCT__ "BConeHessian"
00108 static int BConeHessian(void* dcone, double mu, DSDPSchurMat M,
00109                         DSDPVec vrhs1, DSDPVec vrhs2){
00110   int info,i,ii;
00111   BCone bcone=(BCone)dcone;
00112   int *ib=bcone->ib, nn=bcone->nn;
00113   double *us=bcone->us;
00114   double *au=bcone->au,*u=bcone->u;
00115   double dd,cc,rr,cs,as,rs;
00116   double r=bcone->r;
00117   DSDPVec DD=bcone->WY,MScale=bcone->WY2;
00118   
00119   DSDPFunctionBegin;
00120   if (bcone->nn<1) return 0;
00121   mu*=bcone->muscale;
00122   info=DSDPVecZero(DD);DSDPCHKERR(info);
00123 
00124   info=DSDPSchurMatDiagonalScaling(M,MScale);DSDPCHKERR(info);
00125   info=DSDPVecGetC(MScale,&cc);DSDPCHKERR(info);
00126   info=DSDPVecGetR(MScale,&rr);DSDPCHKERR(info);
00127   for (i=0;i<nn;i++){
00128     ii=ib[i];
00129     info=DSDPVecGetElement(MScale,ii,&dd);DSDPCHKERR(info);
00130 
00131     cs=cc*u[i]/us[i];
00132     as=dd*au[i]/us[i];
00133     rs=rr*r/us[i];
00134 
00135     if (cs){
00136       info=DSDPVecAddC(vrhs2,mu*cs);DSDPCHKERR(info);
00137       info=DSDPVecAddC(DD,mu*cs*cs);DSDPCHKERR(info);
00138       info=DSDPSchurMatAddC(M,ii,mu*as*cs);DSDPCHKERR(info);
00139       info=DSDPSchurMatAddR(M,0,mu*cs*rs);DSDPCHKERR(info);
00140     }
00141     if (as){
00142       info=DSDPVecAddElement(vrhs2,ii,mu*as);DSDPCHKERR(info);
00143       info=DSDPVecAddElement(DD,ii,mu*as*as);DSDPCHKERR(info);
00144     }
00145     if (rs){
00146       info=DSDPVecAddR(vrhs2,mu*rs);DSDPCHKERR(info);
00147       info=DSDPVecAddR(DD,mu*rs*rs);DSDPCHKERR(info);
00148       info=DSDPSchurMatAddR(M,ii,mu*as*rs);DSDPCHKERR(info);
00149     }
00150 
00151   }
00152   info=DSDPSchurMatAddDiagonal(M,DD);DSDPCHKERR(info);
00153   
00154   DSDPFunctionReturn(0);
00155 }
00156 
00157 #undef __FUNCT__  
00158 #define __FUNCT__ "BConeHessian"
00159 static int BConeRHS(void* dcone, double mu, DSDPVec vrow,
00160                          DSDPVec vrhs1, DSDPVec vrhs2){
00161   int info,i,ii;
00162   BCone bcone=(BCone)dcone;
00163   int *ib=bcone->ib, nn=bcone->nn;
00164   double *us=bcone->us, *au=bcone->au,*u=bcone->u;
00165   double dd,cc,rr,cs,as,rs;
00166   double r=bcone->r;
00167   
00168   DSDPFunctionBegin;
00169   mu*=bcone->muscale;
00170   info=DSDPVecGetC(vrow,&cc);DSDPCHKERR(info);
00171   info=DSDPVecGetR(vrow,&rr);DSDPCHKERR(info);
00172   for (i=0;i<nn;i++){
00173     ii=ib[i];
00174     info=DSDPVecGetElement(vrow,ii,&dd);DSDPCHKERR(info);
00175 
00176     cs=cc*u[i]/us[i];
00177     as=dd*au[i]/us[i];
00178     rs=rr*r/us[i];
00179 
00180     if (cs){
00181       info=DSDPVecAddC(vrhs2,mu*cs);DSDPCHKERR(info);
00182     }
00183     if (as){
00184       info=DSDPVecAddElement(vrhs2,ii,mu*as);DSDPCHKERR(info);
00185     }
00186     if (rs){
00187       info=DSDPVecAddR(vrhs2,mu*rs);DSDPCHKERR(info);
00188     }
00189 
00190   }
00191   DSDPFunctionReturn(0);
00192 }
00193 
00194 
00195 #undef __FUNCT__  
00196 #define __FUNCT__ "BConeMultiply"
00197 static int BConeMultiply(void* dcone,  double mu, DSDPVec vrow, DSDPVec vin, DSDPVec vout){
00198   int info,i,ii;
00199   BCone bcone=(BCone)dcone;
00200   int *ib=bcone->ib, nn=bcone->nn;
00201   double *au=bcone->au,*us=bcone->us;
00202   double assa,dd,vv;
00203    
00204   DSDPFunctionBegin;
00205   mu*=bcone->muscale;
00206   for (i=0;i<nn;i++){
00207     ii=ib[i];
00208     info=DSDPVecGetElement(vin,ii,&dd);DSDPCHKERR(info);
00209     info=DSDPVecGetElement(vrow,ii,&vv);DSDPCHKERR(info);
00210     if (dd==0 || vv==0) continue;
00211     assa=(au[i]/us[i]);
00212     assa=mu*vv*assa*assa;
00213     info=DSDPVecAddElement(vout,ii,assa);DSDPCHKERR(info);
00214   }
00215   DSDPFunctionReturn(0);
00216 }
00217 
00218 #undef __FUNCT__  
00219 #define __FUNCT__ "BConeS"
00220 static int BConeS(void* dcone,DSDPVec Y,DSDPDualFactorMatrix flag,DSDPTruth *psdefinite){
00221   int i,info;
00222   BCone bcone=(BCone)dcone;
00223   int nn=bcone->nn;
00224   double *us;
00225   DSDPFunctionBegin;
00226 
00227   if (flag==DUAL_FACTOR){
00228     us=bcone->us;
00229   } else {
00230     us=bcone->uss;
00231   }
00232   info=BConeComputeS(bcone,Y,us,nn);DSDPCHKERR(info);
00233   *psdefinite=DSDP_TRUE;
00234   for (i=0;i<nn;i++){
00235     if (us[i]<=0){*psdefinite=DSDP_FALSE;break;}
00236   }
00237 
00238   DSDPFunctionReturn(0);
00239 }
00240 
00241 #undef __FUNCT__  
00242 #define __FUNCT__ "BConeSInvert"
00243 static int BConeSInvert(void* dcone){
00244   DSDPFunctionBegin;
00245   DSDPFunctionReturn(0);
00246 }
00247 
00248 
00249 #undef __FUNCT__  
00250 #define __FUNCT__ "BConeSetX"
00251 static int BConeSetX(void* dcone,double mu, DSDPVec Y,DSDPVec DY){
00252   DSDPFunctionBegin;
00253   DSDPFunctionReturn(0);
00254 }
00255 
00256 #undef __FUNCT__  
00257 #define __FUNCT__ "BConeX"
00258 static int BConeX(void* dcone,double mu, DSDPVec Y,DSDPVec DY, DSDPVec AX , double *tracexs){
00259   int i,ii,info;
00260   BCone bcone=(BCone)dcone;
00261   int *ib=bcone->ib, nn=bcone->nn;
00262   double *au=bcone->au, *us=bcone->uss, *ux=bcone->ux, *uds=bcone->uds, *u=bcone->u;
00263   double *xuout=bcone->xuout;
00264   double ds,dus,dau,xx,cr,rr;
00265   double pobj1=0,xdots1=0;
00266   DSDPTruth psdefinite;
00267 
00268   DSDPFunctionBegin;
00269 
00270   info=BConeS(dcone,Y,PRIMAL_FACTOR,&psdefinite); DSDPCHKERR(info);
00271   info=BConeComputeS(bcone,DY,uds,nn);DSDPCHKERR(info);
00272   info=DSDPVecGetC(Y,&cr);DSDPCHKERR(info);
00273   info=DSDPVecGetR(Y,&rr);DSDPCHKERR(info);
00274 
00275   mu*=bcone->muscale;
00276   for (i=0;i<nn;i++){
00277     ii=ib[i];
00278     ds=uds[i]; dus=us[i]; dau=au[i];
00279     xx=(mu/dus)-(mu/dus)*(ds/dus);
00280     ux[i]=xx;
00281     info=DSDPVecAddElement(AX,ii,dau*xx);DSDPCHKERR(info);
00282     xdots1+=xx*us[i];
00283     pobj1+=xx*u[i];
00284     if (xuout) xuout[i]=xx;
00285   }
00286 
00287   info=DSDPVecAddC(AX,pobj1);DSDPCHKERR(info);
00288   *tracexs+=xdots1;
00289   DSDPFunctionReturn(0);
00290 }
00291 
00292 
00293 #undef __FUNCT__
00294 #define __FUNCT__ "BConeComputeMaxStepLength"
00295 static int BConeComputeMaxStepLength(void* dcone, DSDPVec DY, DSDPDualFactorMatrix flag, double *maxsteplength){
00296   int i,info;
00297   double mstep=1.0e200;
00298   BCone bcone=(BCone)dcone;
00299   int nn=bcone->nn;
00300   double *us,*uds=bcone->uds;
00301   DSDPFunctionBegin;
00302   
00303   if (bcone->nn<1) return 0;
00304   if (flag==DUAL_FACTOR){
00305     us=bcone->us;
00306   } else {
00307     us=bcone->uss;
00308   }
00309 
00310   info=BConeComputeS(bcone,DY,uds,nn);DSDPCHKERR(info);
00311 
00312   for (i=0;i<nn;i++){
00313     if (uds[i]<0){mstep=DSDPMin(mstep,-us[i]/uds[i]);}
00314   }
00315 
00316   *maxsteplength=mstep;
00317 
00318   DSDPFunctionReturn(0);
00319 }
00320 
00321 
00322 #undef __FUNCT__  
00323 #define __FUNCT__ "BConePotential"
00324 static int BConePotential(void* dcone, double *logobj, double *logdet){
00325   BCone bcone=(BCone)dcone;
00326   int i;
00327   double sumlog=0;
00328   double mu=bcone->muscale;
00329   int nn=bcone->nn;
00330   double *us=bcone->us;
00331 
00332   DSDPFunctionBegin;
00333   if (bcone->nn<1) return 0;
00334   for (i=0;i<nn;i++){
00335     sumlog+= mu*log(us[i]);
00336   }
00337   *logdet=sumlog;
00338   *logobj=0;
00339   DSDPFunctionReturn(0);
00340 }
00341 
00342 #undef __FUNCT__  
00343 #define __FUNCT__ "BConeSparsity"
00344 static int BConeSparsity(void *dcone,int row, int *tnnz, int rnnz[], int m){
00345   DSDPFunctionBegin;
00346   *tnnz=1;rnnz[row]++;
00347   DSDPFunctionReturn(0);
00348 }
00349 
00350 
00351 #undef __FUNCT__  
00352 #define __FUNCT__ "BConeMonitor"
00353 static int BConeMonitor(void *dcone,int di){
00354   DSDPFunctionBegin;
00355   DSDPFunctionReturn(0);
00356 }
00357 
00358 
00359 #undef __FUNCT__  
00360 #define __FUNCT__ "LPANorm2"
00361 static int LPANorm2( void *dcone, DSDPVec ANorm){
00362   BCone bcone=(BCone)dcone;
00363   int *ib=bcone->ib, nn=bcone->nn;
00364   double *u=bcone->u;
00365   double yy=1.0,cnorm2=0;
00366   int i,ii,info;
00367   DSDPFunctionBegin;
00368   for (i=0;i<nn;i++){
00369     ii=ib[i]; yy=1.0;
00370     info=DSDPVecAddElement(ANorm,ii,yy);
00371     yy=u[i]; cnorm2+=yy*yy;
00372   }
00373   info=DSDPVecAddC(ANorm,cnorm2);
00374   info=DSDPVecAddR(ANorm,bcone->r*bcone->nn);
00375   DSDPFunctionReturn(0);
00376 }
00377 
00378 
00379 #undef __FUNCT__  
00380 #define __FUNCT__ "BConeView"
00381 int BConeView(BCone bcone){
00382   int i,ii;
00383   int *ib=bcone->ib, nn=bcone->nn;
00384   double  *au=bcone->au,*u=bcone->u;
00385   DSDPFunctionBegin;
00386   BConeValid(bcone);
00387   ib=bcone->ib; nn=bcone->nn;
00388   au=bcone->au;  u=bcone->u;
00389   for (i=0;i<nn;i++){
00390     ii=ib[i];
00391     if (au[i]>0){
00392       printf("Upper Bound.  Var %d: %4.8e\n",ii,u[i]);
00393     } else {
00394       printf("Lower Bound.  Var %d: %4.8e\n",ii,u[i]);
00395     }
00396   }
00397   DSDPFunctionReturn(0);
00398 }
00399 
00400 
00401 static struct  DSDPCone_Ops kops;
00402 static const char *bconename="VariableBounds Cone";
00403 
00404 #undef __FUNCT__
00405 #define __FUNCT__ "BConeOperationsInitialize"
00406 static int BConeOperationsInitialize(struct  DSDPCone_Ops* coneops){
00407   int info;
00408   if (coneops==NULL) return 0;
00409   info=DSDPConeOpsInitialize(coneops); DSDPCHKERR(info);
00410   coneops->conehessian=BConeHessian;
00411   coneops->conerhs=BConeRHS;
00412   coneops->conesetup=BConeSetup;
00413   coneops->conesetup2=BConeSetup2;
00414   coneops->conedestroy=BConeDestroy;
00415   coneops->conecomputes=BConeS;
00416   coneops->coneinverts=BConeSInvert;
00417   coneops->conecomputex=BConeX;
00418   coneops->conesetxmaker=BConeSetX;
00419   coneops->conemaxsteplength=BConeComputeMaxStepLength;
00420   coneops->conelogpotential=BConePotential;
00421   coneops->conesize=BConeSize;
00422   coneops->conemonitor=BConeMonitor;
00423   coneops->conesparsity=BConeSparsity;
00424   coneops->conehmultiplyadd=BConeMultiply;
00425   coneops->coneanorm2=LPANorm2;
00426   coneops->id=2;
00427   coneops->name=bconename;
00428   return 0;
00429 }
00430 
00431 #undef __FUNCT__
00432 #define __FUNCT__ "DSDPAddBounds"
00433 int DSDPAddBounds(DSDP dsdp,BCone bcone){
00434   int info;
00435   DSDPFunctionBegin;
00436   BConeValid(bcone);
00437   info=BConeOperationsInitialize(&kops); DSDPCHKERR(info);
00438   info=DSDPAddCone(dsdp,&kops,(void*)bcone); DSDPCHKERR(info);
00439   DSDPFunctionReturn(0); 
00440 }
00441 
00442 #undef __FUNCT__
00443 #define __FUNCT__ "DSDPCreateBCone"
00444 
00467 int DSDPCreateBCone(DSDP dsdp, BCone *dspcone){
00468   int m,info;
00469   struct BCone_C *bcone;
00470   DSDPFunctionBegin;
00471   if (!dsdp){DSDPFunctionReturn(1);}
00472   DSDPCALLOC1(&bcone,struct BCone_C,&info);DSDPCHKERR(info);
00473   bcone->keyid=BKEY;
00474   *dspcone=bcone;
00475   /* info=DSDPAddBounds(dsdp,bcone);DSDPCHKERR(info); */
00476   info=BConeOperationsInitialize(&kops); DSDPCHKERR(info);
00477   info=DSDPAddCone(dsdp,&kops,(void*)bcone); DSDPCHKERR(info);
00478   info=DSDPGetNumberOfVariables(dsdp,&m);DSDPCHKERR(info);
00479   bcone->nn=0;
00480   bcone->m=m;
00481   bcone->muscale=1.0;
00482   bcone->r=1.0;
00483   bcone->nnmax=0;
00484   bcone->xuout=0;
00485   DSDPFunctionReturn(0); 
00486 }
00487 
00488 
00489 #undef __FUNCT__
00490 #define __FUNCT__ "BConeScaleBarrier"
00491 int BConeScaleBarrier(BCone bcone,double muscale){
00492   DSDPFunctionBegin;
00493   BConeValid(bcone);
00494   if (muscale>0){
00495     bcone->muscale=muscale;
00496   }
00497   DSDPFunctionReturn(0); 
00498 }
00499 
00500 #undef __FUNCT__
00501 #define __FUNCT__ "BConeCopyX"
00502 
00517 int BConeCopyX(BCone bcone,double xl[], double xu[], int m){
00518   int i,ii,*ib,nn;
00519   double *xx,*au;
00520   DSDPFunctionBegin;
00521   BConeValid(bcone);
00522   if (m!=bcone->m){ DSDPSETERR1(6,"Invalid Array Length.\n",bcone->m);}
00523   xx=bcone->ux; au=bcone->au; nn=bcone->nn; ib=bcone->ib;
00524   for (i=0;i<m;i++){
00525     xl[i]=0;xu[i]=0;
00526   }
00527   for (i=0;i<nn;i++){
00528     ii=ib[i]-1;
00529     if (au[i]<0){
00530       xl[ii]+=xx[i];
00531     } else {
00532       xu[ii]+=xx[i];
00533     }
00534   }
00535   DSDPFunctionReturn(0); 
00536 }
00537 #undef __FUNCT__
00538 #define __FUNCT__ "BConeSetBound"
00539 int BConeSetBound(BCone bcone,int vari, double ai, double bound){
00540   int spot,info;
00541   DSDPFunctionBegin;
00542   BConeValid(bcone);
00543   if (vari<1 || vari>bcone->m){ DSDPSETERR2(6,"Invalid Variable number 1 <= %d <= %d.\n",vari,bcone->m);}
00544   if (bcone->nn>=bcone->nnmax){
00545     DSDPLogInfo(0,19,"REALLOCATING SPACE FOR BOUNDS! %d \n",bcone->nnmax);
00546     info=BConeAllocateBounds(bcone,2*bcone->nn+4);DSDPCHKERR(info);
00547   }
00548   spot=bcone->nn;
00549   bcone->u[spot]=bound;
00550   bcone->au[spot]=ai;
00551   bcone->ib[spot]=vari;
00552   bcone->nn++;
00553   DSDPFunctionReturn(0); 
00554 }
00555 
00556 #undef __FUNCT__
00557 #define __FUNCT__ "BConeSetLowerBound"
00558 
00566 int BConeSetLowerBound(BCone bcone,int vari, double lbound){
00567   int info;
00568   DSDPFunctionBegin;
00569   info=BConeSetBound(bcone,vari,-1.0,-lbound);DSDPCHKERR(info);
00570   DSDPFunctionReturn(0); 
00571 }
00572 
00573 #undef __FUNCT__
00574 #define __FUNCT__ "BConeSetUpperBound"
00575 
00583 int BConeSetUpperBound(BCone bcone,int vari, double ubound){
00584   int info;
00585   DSDPFunctionBegin;
00586   info=BConeSetBound(bcone,vari,1.0,ubound);DSDPCHKERR(info);
00587   DSDPFunctionReturn(0); 
00588 }
00589 
00590 #undef __FUNCT__
00591 #define __FUNCT__ "BConeSetPSlackVariable"
00592 
00607 int BConeSetPSlackVariable(BCone bcone,int vari){
00608   int info;
00609   DSDPFunctionBegin;
00610   info=BConeSetUpperBound(bcone,vari,0);DSDPCHKERR(info);
00611   DSDPFunctionReturn(0); 
00612 }
00613 
00614 #undef __FUNCT__
00615 #define __FUNCT__ "BConeSetPSurplusVariable"
00616 
00624 int BConeSetPSurplusVariable(BCone bcone,int vari){
00625   int info;
00626   DSDPFunctionBegin;
00627   info=BConeSetLowerBound(bcone,vari,0);DSDPCHKERR(info);
00628   DSDPFunctionReturn(0); 
00629 }
00630 
00631 #undef __FUNCT__  
00632 #define __FUNCT__ "BConeAllocateBounds"
00633 
00645 int BConeAllocateBounds(BCone bcone, int nnz){
00646   int j,info,*uindex;
00647   double *uu,*au;
00648 
00649   DSDPFunctionBegin;
00650   BConeValid(bcone);
00651   if (nnz<=bcone->nnmax){DSDPFunctionReturn(0);}
00652   DSDPCALLOC2(&uu,double,(nnz),&info); DSDPCHKERR(info);
00653   DSDPCALLOC2(&au,double,(nnz),&info); DSDPCHKERR(info);
00654   DSDPCALLOC2(&uindex,int,(nnz),&info); DSDPCHKERR(info);
00655   for (j=0;j<nnz;j++){uu[j]=0; uindex[j]=0; au[j]=0;}
00656   if (bcone->nnmax>0){
00657     for (j=0;j<bcone->nn;j++){uu[j]=bcone->u[j];}
00658     for (j=0;j<bcone->nn;j++){uindex[j]=bcone->ib[j];}
00659     for (j=0;j<bcone->nn;j++){au[j]=bcone->au[j];}
00660     DSDPFREE(&bcone->u,&info);DSDPCHKERR(info);
00661     DSDPFREE(&bcone->au,&info);DSDPCHKERR(info);
00662     DSDPFREE(&bcone->ib,&info);DSDPCHKERR(info);
00663   } else {
00664     bcone->nn=0;
00665   }
00666   bcone->nnmax=nnz;
00667   bcone->u=uu;
00668   bcone->au=au;
00669   bcone->ib=uindex;
00670   DSDPFunctionReturn(0);
00671 }
00672 
00673 #undef __FUNCT__
00674 #define __FUNCT__ "BConeSetXArray"
00675 int BConeSetXArray(BCone bcone,double *xuout, int n){
00676   DSDPFunctionBegin;
00677   BConeValid(bcone);
00678   if (n==bcone->nn) bcone->xuout=xuout;
00679   DSDPFunctionReturn(0); 
00680 }
00681 

Generated on Thu May 22 09:42:47 2008 for DSDP by  doxygen 1.5.5