8#define DSDPNoOperationError(a); { DSDPSETERR1(1,"Delta S Matrix type: %s, Operation not defined\n",(a).dsdpops->matname); }
9#define DSDPChkMatError(a,b); { if (b){ DSDPSETERR1(b,"Delta S Matrix type: %s,\n",(a).dsdpops->matname); } }
12#define __FUNCT__ "DSDPDSMatGetType"
13int DSDPDSMatGetType(
DSDPDSMat A,
int *
id){
16 DSDPFunctionReturn(0);
21#define __FUNCT__ "DSDPDSMatSetData"
36 info=DSDPDSMatTest(*M); DSDPChkMatError(*M,info);
37 DSDPFunctionReturn(0);
42#define __FUNCT__ "DSDPDSMatGetSize"
53 if (A.dsdpops->matgetsize){
54 info=(A.dsdpops->matgetsize)(A.matdata,n); DSDPChkMatError(A,info);
56 DSDPNoOperationError(A);
58 DSDPFunctionReturn(0);
63#define __FUNCT__ "DSDPDSMatDestroy"
73 if (!(*A).dsdpops){
return 0;}
74 if ((*A).dsdpops->matdestroy){
75 info=((*A).dsdpops->matdestroy)((*A).matdata); DSDPChkMatError(*A,info);
80 DSDPFunctionReturn(0);
85#define __FUNCT__ "DSDPDSMatView"
94 if (A.dsdpops->matview){
95 info=(A.dsdpops->matview)(A.matdata); DSDPChkMatError(A,info);
97 printf(
"No viewer available for matrix type: %s",A.dsdpops->matname);
99 DSDPFunctionReturn(0);
104#define __FUNCT__ "DSDPDSMatZeroEntries"
113 if (A.dsdpops->matzeroentries){
114 info=(A.dsdpops->matzeroentries)(A.matdata); DSDPChkMatError(A,info);
116 DSDPNoOperationError(A);
118 DSDPFunctionReturn(0);
122#define __FUNCT__ "DSDPDSMatSetArray"
134 if (A.dsdpops->matseturmat){
137 info=(A.dsdpops->matseturmat)(A.matdata,ds,nn,n); DSDPChkMatError(A,info);
140 DSDPNoOperationError(A);
142 DSDPFunctionReturn(0);
146#define __FUNCT__ "DSDPDSMatMult"
159 if (A.dsdpops->matmult){
160 info=SDPConeVecGetArray(X,&x); DSDPCHKERR(info);
161 info=SDPConeVecGetArray(Y,&y); DSDPCHKERR(info);
162 info=SDPConeVecGetSize(Y,&n); DSDPCHKERR(info);
163 info=(A.dsdpops->matmult)(A.matdata,x,y,n); DSDPChkMatError(A,info);
164 info=SDPConeVecRestoreArray(X,&x); DSDPCHKERR(info);
165 info=SDPConeVecRestoreArray(Y,&y); DSDPCHKERR(info);
167 DSDPNoOperationError(A);
169 DSDPFunctionReturn(0);
173#define __FUNCT__ "DSDPDSVecVec"
186 if (A.dsdpops->matvecvec){
187 info=SDPConeVecGetArray(X,&x); DSDPCHKERR(info);
188 info=SDPConeVecGetSize(X,&n); DSDPCHKERR(info);
189 info=(A.dsdpops->matvecvec)(A.matdata,x,n,vAv); DSDPChkMatError(A,info);
190 info=SDPConeVecRestoreArray(X,&x); DSDPCHKERR(info);
192 DSDPNoOperationError(A);
194 DSDPFunctionReturn(0);
198#define __FUNCT__ "DSDPDSMatCheck"
201 DSDPFunctionReturn(0);
206static const char* dsmatname=
"NOT SET YET";
208#define __FUNCT__ "DSDPDSMatOpsInitialize"
219 aops->matzeroentries=0;
224 aops->matname=dsmatname;
229#define __FUNCT__ "DSDPDSMatTest"
233 if (A.dsdpops==0 || A.dsdpops==&dsdpmatops2){
234 }
else if (A.dsdpops->mattest){
235 DSDPLogInfo(0,120,
"Start to set DS Matrix\n");
236 info=(A.dsdpops->mattest)(A.matdata); DSDPChkMatError(A,info);
237 DSDPLogInfo(0,120,
"Done set DS Matrix\n");
243 DSDPFunctionReturn(0);
248#define __FUNCT__ "DSDPDSMatInitialize"
259 DSDPFunctionReturn(0);
int DSDPDSMatVecVec(DSDPDSMat A, SDPConeVec X, double *vAv)
Compute the product x' A x.
int DSDPDSMatSetArray(DSDPDSMat A, DSDPVMat T)
Set values into the matrix.
int DSDPDSMatView(DSDPDSMat A)
Print the matrix.
int DSDPDSMatSetData(DSDPDSMat *M, struct DSDPDSMat_Ops *ops, void *data)
Set the opaque pointer and function pointers to the matrix.
int DSDPDSMatOpsInitialize(struct DSDPDSMat_Ops *aops)
Set pointers to null.
int DSDPDSMatGetSize(DSDPDSMat A, int *n)
Set the opaque pointer and function pointers to the matrix.
int DSDPDSMatDestroy(DSDPDSMat *A)
Free the data structure.
int DSDPDSMatZeroEntries(DSDPDSMat A)
Zero the entries in the matrix.
int DSDPDSMatMult(DSDPDSMat A, SDPConeVec X, SDPConeVec Y)
Set values into the matrix.
int DSDPDSMatInitialize(DSDPDSMat *B)
Set pointers to null.
The interface between the SDPCone and the Delta S matrix.
Structure of function pointers that each SDP Delta S matrix type (sparse, dense, diagonal,...
Error handling, printing, and profiling.
int DSDPVMatGetArray(DSDPVMat X, double **v, int *nn)
Get the array that stores the matrix.
int DSDPVMatGetSize(DSDPVMat X, int *n)
Get number of rows and columns.
int DSDPVMatRestoreArray(DSDPVMat X, double **v, int *nn)
Restore the array that stores the matrix.
Symmetric Delta S matrix for one block in the semidefinite cone.
Symmetric Delta S matrix for one block in the semidefinite cone.
Dense symmetric matrix for one block in the semidefinite cone.
Vector whose length corresponds to dimension of a block in a cone.