dsdpblock.c
Go to the documentation of this file.
#include "dsdpsdp.h"
#include "dsdpsys.h"
static int sdpvecvecevent=0,sdpdotevent=0;
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockASum"
int DSDPBlockASum(DSDPBlockData *ADATA, double aa, DSDPVec Yk, DSDPVMat XX){
double *xx,ytmp,scl=ADATA->scl;
int ii,vari,n,nn,info;
DSDPFunctionBegin;
info=DSDPVMatGetSize(XX, &n); DSDPCHKERR(info);
info=DSDPVMatGetArray(XX, &xx, &nn); DSDPCHKERR(info);
for (ii=0;ii<ADATA->nnzmats;ii++){
vari=ADATA->nzmat[ii];
info=DSDPVecGetElement(Yk,vari,&ytmp);DSDPCHKVARERR(vari,info);
if (ytmp==0) continue;
info = DSDPDataMatAddMultiple(ADATA->A[ii], -aa*scl*ytmp, xx,nn,n); DSDPCHKVARERR(vari,info);
}
info=DSDPVMatRestoreArray(XX, &xx, &nn); DSDPCHKERR(info);
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockADot"
int DSDPBlockADot(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, DSDPVMat X, DSDPVec AX){
int ii,vari,n,nn,info;
double *x,sum=0,aalpha=0,scl=ADATA->scl;
DSDPFunctionBegin;
DSDPEventLogBegin(sdpdotevent);
info=DSDPVMatScaleDiagonal(X,0.5); DSDPCHKERR(info);
info=DSDPVMatGetSize(X, &n); DSDPCHKERR(info);
info=DSDPVMatGetArray(X, &x, &nn); DSDPCHKERR(info);
for (ii=0;ii<ADATA->nnzmats; ii++){ /* Matrix Entries */
vari=ADATA->nzmat[ii];
info=DSDPVecGetElement(Alpha,vari,&aalpha);DSDPCHKVARERR(vari,info);
if (aalpha==0.0) continue;
info=DSDPDataMatDot(ADATA->A[ii],x,nn,n,&sum);DSDPCHKVARERR(vari,info);
info=DSDPVecAddElement(AX,vari,aa*aalpha*sum*scl);DSDPCHKVARERR(vari,info);
}
info=DSDPVMatRestoreArray(X, &x, &nn); DSDPCHKERR(info);
info=DSDPVMatScaleDiagonal(X,2.0); DSDPCHKERR(info);
DSDPEventLogEnd(sdpdotevent);
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockvAv"
int DSDPBlockvAv(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, SDPConeVec V, DSDPVec VAV){
int ii,vari,info;
double sum=0,aalpha=0,scl=ADATA->scl;
DSDPFunctionBegin;
DSDPEventLogBegin(sdpvecvecevent);
if (aa==0){DSDPFunctionReturn(0);}
for (ii=0;ii<ADATA->nnzmats; ii++){ /* Matrix Entries */
vari=ADATA->nzmat[ii];
info=DSDPVecGetElement(Alpha,vari,&aalpha);DSDPCHKVARERR(vari,info);
if (aalpha==0.0) continue;
info=DSDPDataMatVecVec(ADATA->A[ii],V,&sum);DSDPCHKVARERR(vari,info);
info=DSDPVecAddElement(VAV,vari,aa*aalpha*sum*scl);DSDPCHKVARERR(vari,info);
}
DSDPEventLogEnd(sdpvecvecevent);
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockFactorData"
int DSDPBlockFactorData(DSDPBlockData *ADATA,
DSDPVMat X, SDPConeVec W){
int ii,vari,n,nn,info,*iwork3n,i13,n26;
double *x,*dwork3n;
DSDPDataMat AA;
DSDPFunctionBegin;
info=DSDPVMatGetSize(X, &n); DSDPCHKERR(info);
i13=13*n+1;n26=26*n+1;
DSDPCALLOC2(&dwork3n,double,n26,&info);DSDPCHKERR(info);
DSDPCALLOC2(&iwork3n,int,i13,&info);DSDPCHKERR(info);
info=DSDPVMatGetArray(X, &x, &nn); DSDPCHKERR(info);
for (ii=0;ii<ADATA->nnzmats; ii++){ /* Matrix Entries */
info=DSDPBlockGetMatrix(ADATA,ii,&vari,0,&AA);DSDPCHKVARERR(vari,info);
DSDPLogInfo(0,39,"SDP Data Mat Setup: %d\n",vari);
if (vari==0) continue;
info=DSDPDataMatFactor(AA,W,x,nn,dwork3n,n26,iwork3n,i13); DSDPCHKVARERR(vari,info);
}
info=DSDPVMatRestoreArray(X, &x, &nn); DSDPCHKERR(info);
DSDPFREE(&dwork3n,&info);DSDPCHKERR(info);
DSDPFREE(&iwork3n,&info);DSDPCHKERR(info);
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockEventZero"
int DSDPBlockEventZero(void){
DSDPFunctionBegin;
sdpvecvecevent=0;sdpdotevent=0;
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockEventInitialize"
int DSDPBlockEventInitialize(void){
DSDPFunctionBegin;
if (sdpvecvecevent==0){DSDPEventLogRegister("SDP VecMatVec",&sdpvecvecevent);}
if (sdpdotevent==0){DSDPEventLogRegister("SDP Dot",&sdpdotevent);}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockDataInitialize"
int DSDPBlockDataInitialize(DSDPBlockData *ADATA){
DSDPFunctionBegin;
ADATA->nnzmats=0;
ADATA->maxnnzmats=0;
ADATA->nzmat=0;
ADATA->A=0;
ADATA->r=1.0;
ADATA->scl=1.0;
/* ADATA->n=0; */
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockTakeDownData"
int DSDPBlockTakeDownData(DSDPBlockData *ADATA){
DSDPFunctionBegin;
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockDataDestroy"
int DSDPBlockDataDestroy(DSDPBlockData *ADATA){
int ii,vari,info;
DSDPFunctionBegin;
if (!ADATA){DSDPFunctionReturn(0);}
DSDPLogInfo(0,18,"Destroying All Existing Data Matrices \n");
for (ii=0; ii<ADATA->nnzmats; ii++){
vari=ADATA->nzmat[ii];
info = DSDPDataMatDestroy(&ADATA->A[ii]);DSDPCHKVARERR(vari,info);
ADATA->nzmat[ii]=0;
}
ADATA->nnzmats=0;
info=DSDPBlockTakeDownData(ADATA);DSDPCHKERR(info);
DSDPFREE(&ADATA->nzmat,&info);DSDPCHKERR(info);
DSDPFREE(&ADATA->A,&info);DSDPCHKERR(info);
info=DSDPBlockDataInitialize(ADATA);DSDPCHKERR(info);
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockDataAllocate"
int DSDPBlockDataAllocate(DSDPBlockData *ADATA, int nnz){
int j,info,*nzmat;
DSDPDataMat *A;
DSDPFunctionBegin;
if (!ADATA){DSDPFunctionReturn(0);}
if (nnz<=ADATA->maxnnzmats){DSDPFunctionReturn(0);}
DSDPLogInfo(0,18,"REALLOCATING SPACE FOR %d SDP BLOCK MATRICES! Previously allocated: %d \n",nnz,ADATA->maxnnzmats);
DSDPCALLOC2(&A,struct DSDPDataMat_C,nnz,&info);DSDPCHKERR(info);
DSDPCALLOC2(&nzmat,int,nnz,&info);DSDPCHKERR(info);
for (j=0;j<nnz;j++){nzmat[j]=0;}
for (j=0;j<nnz;j++){info = DSDPDataMatInitialize(&A[j]);DSDPCHKERR(info);}
if (ADATA->maxnnzmats>0){
for (j=0;j<ADATA->nnzmats;j++){nzmat[j]=ADATA->nzmat[j];}
for (j=0;j<ADATA->nnzmats;j++){A[j]=ADATA->A[j];}
DSDPFREE(&ADATA->A,&info);DSDPCHKERR(info);
DSDPFREE(&ADATA->nzmat,&info);DSDPCHKERR(info);
} else {
ADATA->nnzmats=0;
}
ADATA->maxnnzmats=nnz;
ADATA->nzmat=nzmat;
ADATA->A=A;
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockDataMarkNonzeroMatrices"
int DSDPBlockDataMarkNonzeroMatrices(DSDPBlockData *ADATA,int*annz){
int i;
DSDPFunctionBegin;
for (i=0; i<ADATA->nnzmats; i++){
annz[ADATA->nzmat[i]]++;
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockCountNonzerosMatrices"
int DSDPBlockCountNonzeroMatrices(DSDPBlockData *ADATA,int*nzmats){
DSDPFunctionBegin;
*nzmats=ADATA->nnzmats;
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockDataRank"
int DSDPBlockDataRank(DSDPBlockData *ADATA, int *trank, int n){
int ii,vari,info,ri,r2=0;
DSDPDataMat AA;
DSDPFunctionBegin;
for (ii=0;ii<ADATA->nnzmats;ii++){
info=DSDPBlockGetMatrix(ADATA,ii,&vari,0,&AA);DSDPCHKVARERR(vari,info);
if (vari==0) continue;
info=DSDPDataMatGetRank(AA,&ri,n); DSDPCHKVARERR(vari,info);
r2+=ri;
}
*trank=r2;
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockGetMatrix"
int DSDPBlockGetMatrix(DSDPBlockData *ADATA,int id, int *vari, double *scl, DSDPDataMat *A){
DSDPFunctionBegin;
if (id>=0 && id < ADATA->nnzmats){
if (vari) *vari=ADATA->nzmat[id];
if (scl) *scl=ADATA->scl;
if (A) *A=ADATA->A[id];
} else {
DSDPSETERR2(2,"Invalid Matrix request. 0 <= %d < %d\n",id,ADATA->nnzmats);
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockDataRowSparsity"
int DSDPBlockDataRowSparsity(DSDPBlockData *ADATA,int row, int ai[], int rnnz[],int n){
int info,i,vari,rn;
DSDPFunctionBegin;
if (ai){
for (i=0; i<ADATA->nnzmats; i++){
vari=ADATA->nzmat[i];
if (ai[vari]==0){continue;}
info=DSDPDataMatGetRowNonzeros(ADATA->A[i],row, n, rnnz, &rn); DSDPCHKVARERR(vari,info);
}
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockRemoveDataMatrix"
int DSDPBlockRemoveDataMatrix(DSDPBlockData *ADATA,int vari){
int info,ii,k;
DSDPFunctionBegin;
for (ii=0;ii<ADATA->nnzmats;ii++){
if (ADATA->nzmat[ii]==vari){
info=DSDPDataMatDestroy(&ADATA->A[ii]);DSDPCHKVARERR(vari,info);
info=DSDPSetDataMatZero(&ADATA->A[ii]);DSDPCHKVARERR(vari,info);
for (k=ii;k<ADATA->nnzmats;k++){
ADATA->A[k]=ADATA->A[k+1];
ADATA->nzmat[k]=ADATA->nzmat[k+1];
}
ADATA->nnzmats--;
info=DSDPSetDataMatZero(&ADATA->A[ADATA->nnzmats]);DSDPCHKERR(info);
DSDPFunctionReturn(0);
}
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockAddDataMatrix"
int DSDPBlockAddDataMatrix(DSDPBlockData *ADATA,int vari, struct DSDPDataMat_Ops* dsdpdataops, void* data){
int info,ii;
DSDPFunctionBegin;
if (ADATA->nnzmats>=ADATA->maxnnzmats){
info=DSDPBlockDataAllocate(ADATA,2*ADATA->maxnnzmats+7);DSDPCHKERR(info);
}
ii=ADATA->nnzmats;
info=DSDPDataMatDestroy(&ADATA->A[ii]);DSDPCHKERR(info);
info=DSDPDataMatSetData(&ADATA->A[ii], dsdpdataops, data);DSDPCHKVARERR(vari,info);
ADATA->nzmat[ii]=vari;
ADATA->nnzmats++;
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockSetDataMatrix"
int DSDPBlockSetDataMatrix(DSDPBlockData *ADATA,int vari, struct DSDPDataMat_Ops* dsdpdataops, void* data){
int info;
DSDPFunctionBegin;
info=DSDPBlockRemoveDataMatrix(ADATA,vari);DSDPCHKERR(info);
info=DSDPBlockAddDataMatrix(ADATA,vari,dsdpdataops,data);DSDPCHKERR(info);
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockNorm2"
int DSDPBlockNorm2(DSDPBlockData *ADATA, int n){
double fn2,tt=0;
int ii,info;
DSDPFunctionBegin;
for (ii=0;ii<ADATA->nnzmats;ii++){
info=DSDPDataMatFNorm2(ADATA->A[ii],n,&fn2); DSDPCHKERR(info);
tt+=fn2;
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockANorm2"
int DSDPBlockANorm2(DSDPBlockData *ADATA, DSDPVec ANorm2, int n){
double fn2,scl=ADATA->scl;
int ii,vari,info;
DSDPFunctionBegin;
info=DSDPBlockNorm2(ADATA,n);DSDPCHKERR(info);
scl=ADATA->scl;
for (ii=0;ii<ADATA->nnzmats;ii++){
vari=ADATA->nzmat[ii];
info=DSDPDataMatFNorm2(ADATA->A[ii],n,&fn2); DSDPCHKVARERR(vari,info);
info=DSDPVecAddElement(ANorm2,vari,fn2*scl);DSDPCHKVARERR(vari,info);
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockView"
int DSDPBlockView(DSDPBlockData *ADATA){
int ii,kk;
DSDPFunctionBegin;
for (ii=0;ii<ADATA->nnzmats;ii++){
kk=ADATA->nzmat[ii];
if (kk==0){ printf("+ C\n");}
else { printf(" - A[%d] y%d\n",kk,kk);}
}
printf(" = S >= 0\n");
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPBlockView2"
int DSDPBlockView2(DSDPBlockData *ADATA){
int ii,vari,info;
DSDPFunctionBegin;
for (ii=0;ii<ADATA->nnzmats;ii++){
vari=ADATA->nzmat[ii];
printf("A[%d] y%d \n",vari,vari);
info=DSDPDataMatView(ADATA->A[ii]); DSDPCHKERR(info);
}
DSDPFunctionReturn(0);
}
#undef __FUNCT__
#define __FUNCT__ "DSDPDataMatCheck"
int DSDPDataMatCheck(DSDPDataMat AA, SDPConeVec W, DSDPIndex IS, DSDPVMat XX){
double *xx,ack,vAv=0,esum=0,sum,eignorm,fnorm22,dnorm,scl=1;
int k,n,nn,rank,info;
DSDPFunctionBegin;
info=SDPConeVecGetSize(W,&n);DSDPCHKERR(info);
info=DSDPVMatZeroEntries(XX);DSDPCHKERR(info);
info=DSDPDataMatGetRank(AA,&rank,n);DSDPCHKERR(info);
for (k=0; k<rank; k++){
info=DSDPDataMatGetEig(AA,k,W,IS,&ack); DSDPCHKERR(info);
info=SDPConeVecDot(W,W,&eignorm);DSDPCHKERR(info);
info=DSDPVMatAddOuterProduct(XX,scl*ack,W);DSDPCHKERR(info);
info=DSDPDataMatVecVec(AA,W,&sum);DSDPCHKERR(info);
vAv+=ack*ack*eignorm*eignorm*scl;
}
info=DSDPDataMatFNorm2(AA,n,&fnorm22); DSDPCHKERR(info);
info=DSDPVMatScaleDiagonal(XX,0.5); DSDPCHKERR(info);
info=DSDPVMatGetArray(XX, &xx, &nn); DSDPCHKERR(info);
info=DSDPDataMatDot(AA,xx,nn,n,&esum);DSDPCHKERR(info);
info=DSDPVMatRestoreArray(XX, &xx, &nn); DSDPCHKERR(info);
info=DSDPVMatScaleDiagonal(XX,2.0); DSDPCHKERR(info);
info=DSDPVMatGetArray(XX, &xx, &nn); DSDPCHKERR(info);
info=DSDPDataMatAddMultiple(AA,-1.0,xx,nn,n); DSDPCHKERR(info);
info=DSDPVMatRestoreArray(XX, &xx, &nn); DSDPCHKERR(info);
if (0==1){info=DSDPVMatView(XX);DSDPCHKERR(info);}
info=DSDPVMatNormF2(XX,&dnorm); DSDPCHKERR(info);
printf(" %4.4e, %4.4e %4.4e\n",esum,vAv,fnorm22);
printf(" error1: %4.4e, error2: %4.4e, error3: %4.4e\n",sqrt(dnorm),fabs(esum-vAv),fabs(fnorm22-vAv));
if (dnorm>1) printf("Check Add or eigs\n");
if (fabs(esum-vAv) > 1.0) printf("Check vAv \n");
if (fabs(fnorm22-vAv) > 1.0) printf("Check fnorm22\n");
DSDPFunctionReturn(0);
}
DSDPSetDataMatZero
int DSDPSetDataMatZero(DSDPDataMat *A)
Make a data matrix a zero matrix.
Definition dsdpadddatamat.c:537
DSDPDataMatCheck
int DSDPDataMatCheck(DSDPDataMat AA, SDPConeVec W, DSDPIndex IS, DSDPVMat XX)
Check correctness of operations on the data.
Definition dsdpblock.c:498
DSDPBlockView2
int DSDPBlockView2(DSDPBlockData *ADATA)
Print the data.
Definition dsdpblock.c:474
DSDPBlockDataDestroy
int DSDPBlockDataDestroy(DSDPBlockData *ADATA)
Free the data matrices.
Definition dsdpblock.c:195
DSDPBlockDataAllocate
int DSDPBlockDataAllocate(DSDPBlockData *ADATA, int nnz)
Allocate some structures.
Definition dsdpblock.c:221
DSDPBlockGetMatrix
int DSDPBlockGetMatrix(DSDPBlockData *ADATA, int id, int *vari, double *scl, DSDPDataMat *A)
Get a data matrix from a block of data.
Definition dsdpblock.c:307
DSDPBlockDataInitialize
int DSDPBlockDataInitialize(DSDPBlockData *ADATA)
Set pointers to null.
Definition dsdpblock.c:163
DSDPBlockDataMarkNonzeroMatrices
int DSDPBlockDataMarkNonzeroMatrices(DSDPBlockData *ADATA, int *annz)
Mark which variable in block have a data matrix.
Definition dsdpblock.c:254
DSDPBlockAddDataMatrix
int DSDPBlockAddDataMatrix(DSDPBlockData *ADATA, int vari, struct DSDPDataMat_Ops *dsdpdataops, void *data)
Add data matrix into SDP block.
Definition dsdpblock.c:381
DSDPBlockSetDataMatrix
int DSDPBlockSetDataMatrix(DSDPBlockData *ADATA, int vari, struct DSDPDataMat_Ops *dsdpdataops, void *data)
Set data matrix into SDP block.
Definition dsdpblock.c:406
DSDPBlockASum
int DSDPBlockASum(DSDPBlockData *ADATA, double aa, DSDPVec Yk, DSDPVMat XX)
Sum the data matrices.
Definition dsdpblock.c:20
DSDPBlockRemoveDataMatrix
int DSDPBlockRemoveDataMatrix(DSDPBlockData *ADATA, int vari)
Remove a data matrix.
Definition dsdpblock.c:351
DSDPBlockCountNonzeroMatrices
int DSDPBlockCountNonzeroMatrices(DSDPBlockData *ADATA, int *nzmats)
Count how many data matrices are in a block of data.
Definition dsdpblock.c:272
DSDPBlockDataRowSparsity
int DSDPBlockDataRowSparsity(DSDPBlockData *ADATA, int row, int ai[], int rnnz[], int n)
Determine sparsity pattern of data.
Definition dsdpblock.c:330
DSDPBlockvAv
int DSDPBlockvAv(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, SDPConeVec V, DSDPVec VAV)
Set VAV[i] to aa * Alpha[i] * V' A[i] V.
Definition dsdpblock.c:84
DSDPBlockFactorData
int DSDPBlockFactorData(DSDPBlockData *ADATA, DSDPVMat X, SDPConeVec W)
Factor the data matrices.
Definition dsdpblock.c:113
DSDPBlockADot
int DSDPBlockADot(DSDPBlockData *ADATA, double aa, DSDPVec Alpha, DSDPVMat X, DSDPVec AX)
Compute inner product of XX with data matrices.
Definition dsdpblock.c:49
DSDPBlockView
int DSDPBlockView(DSDPBlockData *ADATA)
Print the structure of the block.
Definition dsdpblock.c:454
DSDPBlockTakeDownData
int DSDPBlockTakeDownData(DSDPBlockData *ADATA)
Free structures in block of data.
Definition dsdpblock.c:182
DSDPDataMatAddMultiple
int DSDPDataMatAddMultiple(DSDPDataMat A, double ytmp, double *v, int nn, int n)
Add a multiple the data matrix to the array.
Definition dsdpdatamat.c:402
DSDPDataMatVecVec
int DSDPDataMatVecVec(DSDPDataMat A, SDPConeVec W, double *v)
Compute w' A w.
Definition dsdpdatamat.c:297
DSDPDataMatDestroy
int DSDPDataMatDestroy(DSDPDataMat *A)
Free the data structures.
Definition dsdpdatamat.c:444
DSDPDataMatGetRowNonzeros
int DSDPDataMatGetRowNonzeros(DSDPDataMat A, int nrow, int nmax, int *nz, int *nnz)
Get sparsity pattern of a row of the matrix.
Definition dsdpdatamat.c:355
DSDPDataMatGetEig
int DSDPDataMatGetEig(DSDPDataMat A, int rr, SDPConeVec V, DSDPIndex S, double *eigenvalue)
Get an eigenvalue/vector pair.
Definition dsdpdatamat.c:204
DSDPDataMatView
int DSDPDataMatView(DSDPDataMat A)
Print matrix.
Definition dsdpdatamat.c:423
DSDPDataMatSetData
int DSDPDataMatSetData(DSDPDataMat *A, struct DSDPDataMat_Ops *ops, void *data)
Set the opaque pointer and function pointers to the matrix.
Definition dsdpdatamat.c:25
DSDPDataMatGetRank
int DSDPDataMatGetRank(DSDPDataMat A, int *rank, int n)
Get the number of nonzero eigenvalues/eigenvectors for the matrix.
Definition dsdpdatamat.c:129
DSDPDataMatDot
int DSDPDataMatDot(DSDPDataMat A, double x[], int nn, int n, double *v)
Compute inner product of data with a dense matrix.
Definition dsdpdatamat.c:273
DSDPDataMatFNorm2
int DSDPDataMatFNorm2(DSDPDataMat A, int n, double *fnorm2)
Compute the square of the Frobenius norm.
Definition dsdpdatamat.c:175
DSDPDataMatFactor
int DSDPDataMatFactor(DSDPDataMat A, SDPConeVec W, double *dworknn, int nn0, double *dwork3n, int nd, int *iwork, int ni)
Do eigenvalue/vector or other factorization.
Definition dsdpdatamat.c:240
DSDPDataMatInitialize
int DSDPDataMatInitialize(DSDPDataMat *A)
Set pointers to NULL;.
Definition dsdpdatamat.c:78
dsdpsdp.h
Internal SDPCone data structures and routines.
dsdpsys.h
Error handling, printing, and profiling.
DSDPVec
struct DSDPVec_C DSDPVec
This object hold m+2 variables: a scaling of C, the y variables, and r.
Definition dsdpvec.h:25
DSDPVMatNormF2
int DSDPVMatNormF2(DSDPVMat X, double *normf2)
Compute square of Frobenius norm of matrix.
Definition dsdpxmat.c:186
DSDPVMatGetArray
int DSDPVMatGetArray(DSDPVMat X, double **v, int *nn)
Get the array that stores the matrix.
Definition dsdpxmat.c:211
DSDPVMatGetSize
int DSDPVMatGetSize(DSDPVMat X, int *n)
Get number of rows and columns.
Definition dsdpxmat.c:65
DSDPVMatRestoreArray
int DSDPVMatRestoreArray(DSDPVMat X, double **v, int *nn)
Restore the array that stores the matrix.
Definition dsdpxmat.c:233
DSDPVMatZeroEntries
int DSDPVMatZeroEntries(DSDPVMat X)
Zero matrix.
Definition dsdpxmat.c:125
DSDPVMatAddOuterProduct
int DSDPVMatAddOuterProduct(DSDPVMat X, double alpha, SDPConeVec V)
Add outer product of a vector to the matrix.
Definition dsdpxmat.c:275
DSDPVMatScaleDiagonal
int DSDPVMatScaleDiagonal(DSDPVMat X, double dscale)
Scaling diagonal is useful for inner products and norms.
Definition dsdpxmat.c:147
DSDPVMatView
int DSDPVMatView(DSDPVMat X)
Print matrix.
Definition dsdpxmat.c:107
SDPConeVecDot
int SDPConeVecDot(SDPConeVec V1, SDPConeVec V2, double *ans)
Inner product of two vectors.
Definition sdpconevec.c:125
DSDPBlockData
Internal structure for data in one block of semidefintie.
Definition dsdpsdp.h:39
DSDPDataMat_C
Symmetric data matrix for one block in the semidefinite cone.
Definition dsdpdatamat.h:15
DSDPDataMat_Ops
Table of function pointers that operate on the data matrix.
Definition dsdpdatamat_impl.h:15
DSDPVMat_C
Dense symmetric matrix for one block in the semidefinite cone.
Definition dsdpxmat.h:17
SDPConeVec_C
Vector whose length corresponds to dimension of a block in a cone.
Definition sdpconevec.h:13