14static int ConstMatDestroy(
void*);
15static int ConstMatView(
void*);
16static int ConstMatVecVec(
void*,
double[],
int,
double *);
17static int ConstMatDot(
void*,
double[],
int,
int,
double *);
18static int ConstMatGetRank(
void*,
int*,
int);
19static int ConstMatFactor(
void*);
20static int ConstMatGetEig(
void*,
int,
double*,
double[],
int,
int[],
int*);
21static int ConstMatRowNnz(
void*,
int,
int[],
int*,
int);
22static int ConstMatAddRowMultiple(
void*,
int,
double,
double[],
int);
23static int ConstMatAddMultiple(
void*,
double,
double[],
int,
int);
24static int ConstMatTest(
void*);
30#define __FUNCT__ "DSDPGetConstantMat"
31int DSDPGetConstantMat(
int n,
double value,
char UPLQ,
struct DSDPDataMat_Ops**mops,
void**mmat){
35 AA=(cmat*) malloc(1*
sizeof(cmat));
36 if (AA==NULL)
return 1;
40 info=ConstMatOpsInitialize(&constantmatops);
if(info){
return 1;}
41 if (mops){*mops=&constantmatops;}
42 if (mmat){*mmat=(
void*)AA;}
43 DSDPFunctionReturn(0);
47static int ConstMatDot(
void* A,
double x[],
int nn,
int n,
double *v){
68static int ConstMatVecVec(
void* A,
double x[],
int n,
double *v){
77 *v=dtmp*dtmp*AA->cnst;
81static int ConstMatAddMultiple(
void*A,
double dd,
double vv[],
int nn,
int n){
84 double ddd=dd*AA->cnst;
99static int ConstMatAddRowMultiple(
void*A,
int nrow,
double dd,
double row[],
int n){
102 double ddd=dd*AA->cnst;
112static int ConstMatFactor(
void*A){
116static int ConstMatGetRank(
void *A,
int*rank,
int n){
121static int ConstMatGetEig(
void*A,
int neig,
double *eig,
double v[],
int n,
int indx[],
int*nind){
124 if (neig!=0)
return 1;
126 for (i=0;i<n;i++){ v[i]=1.0; indx[i]=i;}
127 *eig=AA->cnst; *nind=n;
129 for (i=0;i<n;i++){ v[i]=0.0; }
136static int ConstMatRowNnz(
void*A,
int row,
int nz[],
int *nnz,
int n){
138 for (i=0;i<n;i++){ nz[i]++; }
143static int ConstMatFNorm2(
void*AA,
int n,
double *fnorm2){
145 *fnorm2=A->cnst*A->cnst*n*n;
149static int ConstMatCountNonzeros(
void*A,
int *nnz,
int n){
157static int ConstMatView(
void* AA){
159 printf(
"Every element of the matrix is the same: %10.8e\n",A->cnst);
163static int ConstMatTest(
void* AA){
168static int ConstMatDestroy(
void* A){
173static const char *datamatname=
"ALL ELEMENTS THE SAME";
176 if (cmatops==NULL)
return 0;
178 cmatops->matfactor1=ConstMatFactor;
179 cmatops->matgetrank=ConstMatGetRank;
180 cmatops->matgeteig=ConstMatGetEig;
181 cmatops->matvecvec=ConstMatVecVec;
182 cmatops->matdot=ConstMatDot;
183 cmatops->mataddrowmultiple=ConstMatAddRowMultiple;
184 cmatops->mataddallmultiple=ConstMatAddMultiple;
185 cmatops->matdestroy=ConstMatDestroy;
186 cmatops->mattest=ConstMatTest;
187 cmatops->matview=ConstMatView;
188 cmatops->matrownz=ConstMatRowNnz;
189 cmatops->matfnorm2=ConstMatFNorm2;
190 cmatops->matnnz=ConstMatCountNonzeros;
192 cmatops->matname=datamatname;
int DSDPDataMatOpsInitialize(struct DSDPDataMat_Ops *dops)
Initialize the table of function pointers for SDP Data matrices.
Structure of function pointers that each SDP data matrix type (sparse, dense, constant,...
Error handling, printing, and profiling.
Table of function pointers that operate on the data matrix.