1 #include "dsdpdatamat_impl.h"
2 #include "dsdpsys.h"
3 /*!
4 \file zeromat.c
5 \brief DSDPDataMat object with all zero entries.
6 */
7 static int ZDestroy(void*);
8 static int ZView(void*);
9 static int ZVecVec(void*, double[], int, double *);
10 static int ZDot(void*, double[], int, int,double *);
11 static int ZGetRank(void*, int*,int);
12 static int ZFactor(void*);
13 static int ZGetEig(void*, int, double*, double[], int,int[],int*);
14 static int ZAddRowMultiple(void*, int, double, double[], int);
15 static int ZAddMultiple(void*, double, double[], int,int);
16 static int ZRowNnz(void*, int, int[], int*, int);
17 
18 static struct  DSDPDataMat_Ops zeromatops;
19 static int ZeroMatopsInitialize(struct DSDPDataMat_Ops*);
20 
DSDPGetZeroDataMatOps(struct DSDPDataMat_Ops ** zops)21 int DSDPGetZeroDataMatOps(struct DSDPDataMat_Ops** zops){
22   int info;
23   info=ZeroMatopsInitialize(&zeromatops); if (info){return info;}
24   if (zops){*zops=&zeromatops;}
25   return info;
26 }
27 
ZFactor(void * A)28 static int ZFactor(void *A){
29   return 0;
30 }
31 
ZGetRank(void * A,int * rank,int n)32 static int ZGetRank(void*A,int*rank,int n){
33   *rank=0;
34   return 0;
35 }
36 
ZGetEig(void * A,int neig,double * eig,double v[],int n,int indx[],int * nind)37 static int ZGetEig(void*A,int neig, double *eig, double v[], int n,int indx[],int*nind){
38   *eig=0.0;
39   *nind=0;
40   return 0;
41 }
42 
ZDot(void * A,double x[],int nn,int n,double * sum)43 static int ZDot(void*A, double x[], int nn, int n, double *sum){
44   *sum=0.0;
45   return 0;
46 }
47 
ZVecVec(void * A,double x[],int n,double * sum)48 static int ZVecVec(void*A, double x[], int n, double *sum){
49   *sum=0.0;
50   return 0;
51 }
52 
ZAddMultiple(void * A,double dd,double row[],int nn,int n)53 static int ZAddMultiple(void*A, double dd, double row[], int nn, int n){
54   return 0;
55 }
56 
ZAddRowMultiple(void * A,int nrow,double dd,double row[],int n)57 static int ZAddRowMultiple(void*A, int nrow, double dd, double row[], int n){
58   return 0;
59 }
60 
ZRowNnz(void * A,int row,int nz[],int * nnz,int n)61 static int ZRowNnz(void*A, int row, int nz[], int *nnz, int n){
62   *nnz=0;
63   return 0;
64 }
65 
ZDestroy(void * A)66 static int ZDestroy(void*A){
67   return 0;
68 }
69 
ZNorm2(void * A,int n,double * v)70 static int ZNorm2(void*A,int n,double *v){
71   *v=0;
72   return 0;
73 }
74 
ZView(void * A)75 static int ZView(void*A){
76   printf("All zeros\n");
77   return 0;
78 }
79 
80 static const char* datamatname="MATRIX OF ZEROS";
81 
ZeroMatopsInitialize(struct DSDPDataMat_Ops * sops)82 static int ZeroMatopsInitialize(struct  DSDPDataMat_Ops* sops){
83   int info;
84   if (sops==NULL) return 0;
85   info=DSDPDataMatOpsInitialize(sops); if (info){ return info;}
86   sops->matfactor1=ZFactor;
87   sops->matgetrank=ZGetRank;
88   sops->matgeteig=ZGetEig;
89   sops->matvecvec=ZVecVec;
90   sops->matdot=ZDot;
91   sops->matfnorm2=ZNorm2;
92   sops->matrownz=ZRowNnz;
93   sops->mataddrowmultiple=ZAddRowMultiple;
94   sops->mataddallmultiple=ZAddMultiple;
95   sops->matdestroy=ZDestroy;
96   sops->matview=ZView;
97   sops->id=10;
98   sops->matname=datamatname;
99   return 0;
100 }
101 
102 
103 
104