Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c195220588f848deaab369113d3744a0e14d9dce
[simgrid.git] / include / csdp / declarations.h
1 /*
2   This file is part of the CSDP 5.0 package developed by Dr. Brian Borchers.
3   Which can be distributed under the LGPL licence. The source code and 
4   manual can be downloaded at http://euler.nmt.edu/~brian/csdp.html.
5
6   Other important includes that we need.
7  */
8
9 #include "index.h"
10 #include "blockmat.h"
11 #include "parameters.h"
12
13 /*
14   Our own routines.
15   */
16
17 void triu(struct blockmatrix A);
18
19 void store_packed(struct blockmatrix A, struct blockmatrix B);
20
21 void store_unpacked(struct blockmatrix A, struct blockmatrix B);
22
23 void alloc_mat_packed(struct blockmatrix A, struct blockmatrix *pB);
24
25 void free_mat_packed(struct blockmatrix A);
26
27 int structnnz(int n, int k, struct blockmatrix C, struct constraintmatrix *constraints);
28
29 int actnnz(int n, int lda, double *A);
30
31 int bandwidth(int n, int lda, double *A);
32
33 void qreig(int n, double *maindiag, double *offdiag);
34
35 void sort_entries(int k, struct blockmatrix C, struct constraintmatrix *constraints);
36
37 double norm2(int n, double *x);
38
39 double norm1(int n, double *x);
40
41 double norminf(int n, double *x);
42
43 double Fnorm(struct blockmatrix A);
44
45 double Knorm(struct blockmatrix A);
46
47 double mat1norm(struct blockmatrix A);
48
49 double matinfnorm(struct blockmatrix A);
50
51 double calc_pobj(struct blockmatrix C, struct blockmatrix X, 
52                  double constant_offset);
53
54 double calc_dobj(int k, double *a, double *y, double constant_offset);
55
56 double trace_prod(struct blockmatrix A, struct blockmatrix B);
57
58 double linesearch(int n, struct blockmatrix dX,
59                   struct blockmatrix work1, struct blockmatrix work2, 
60                   struct blockmatrix work3, struct blockmatrix cholinv, 
61                   double *q, double *oldq, double *z, double *workvec,
62                   double stepfrac,double start, int printlevel);
63
64 double pinfeas(int k, struct constraintmatrix *constraints,
65                struct blockmatrix X, double *a, double *workvec);
66
67 double dinfeas(int k, struct blockmatrix C, 
68                struct constraintmatrix *constraints, double *y, 
69                struct blockmatrix Z, struct blockmatrix work1);
70
71 double dimacserr3(int k, struct blockmatrix C, 
72                struct constraintmatrix *constraints, double *y, 
73                struct blockmatrix Z, struct blockmatrix work1);
74
75 void op_a(int k, struct constraintmatrix *constraints,
76           struct blockmatrix X, double *result);
77
78 void op_at(int k, double *y, struct constraintmatrix *constraints,
79            struct blockmatrix result);
80
81 void makefill(int k, struct blockmatrix C, 
82               struct constraintmatrix *constraints, 
83               struct constraintmatrix *pfill, struct blockmatrix work1, 
84               int printlevel);
85
86 void op_o(int k, struct constraintmatrix *constraints,
87           struct sparseblock **byblocks, struct blockmatrix Zi, 
88           struct blockmatrix X, double *O, struct blockmatrix work1, 
89           struct blockmatrix work2);
90
91 void addscaledmat(struct blockmatrix A, double scale, struct blockmatrix B,
92                   struct blockmatrix C);
93
94 void zero_mat(struct blockmatrix A);
95
96 void add_mat(struct blockmatrix A,struct blockmatrix B);
97
98 void sym_mat(struct blockmatrix A);
99
100 void make_i(struct blockmatrix A);
101
102 void copy_mat(struct blockmatrix A, struct blockmatrix B);
103
104 void mat_mult(double scale1, double scale2, struct blockmatrix A,
105               struct blockmatrix B, struct blockmatrix C);
106
107 void mat_multspa(double scale1, double scale2, struct blockmatrix A,
108                  struct blockmatrix B, struct blockmatrix C, 
109                  struct constraintmatrix fill);
110
111 void mat_multspb(double scale1, double scale2, struct blockmatrix A,
112                  struct blockmatrix B, struct blockmatrix C, 
113                  struct constraintmatrix fill);
114
115 void mat_multspc(double scale1, double scale2, struct blockmatrix A,
116                  struct blockmatrix B, struct blockmatrix C, 
117                  struct constraintmatrix fill);
118
119 void mat_mult_raw(int n, double scale1, double scale2, double *ap,
120                   double *bp, double *cp);
121
122 void matvec(struct blockmatrix A, double *x, double *y);
123
124 void alloc_mat(struct blockmatrix A, struct blockmatrix *pB);
125
126 void free_mat(struct blockmatrix A);
127
128 void initparams(struct paramstruc *params, int *pprintlevel);
129
130 void initsoln(int n, int k, struct blockmatrix C, double *a, 
131               struct constraintmatrix *constraints, struct blockmatrix *pX0,
132               double **py0, struct blockmatrix *pZ0);
133
134 void trans(struct blockmatrix A);
135
136 void chol_inv(struct blockmatrix A, struct blockmatrix B);
137
138 int chol(struct blockmatrix A);
139
140 int solvesys(int m, int ldam, double *A, double *rhs);
141
142 int user_exit(int n, int k, struct blockmatrix C, double *a, double dobj,
143               double pobj, double constant_offset, 
144               struct constraintmatrix *constraints, struct blockmatrix X,
145               double *y, struct blockmatrix Z, struct paramstruc params);
146
147 int read_sol(char *fname, int n, int k, struct blockmatrix C, 
148              struct blockmatrix *pX, double **py, struct blockmatrix *pZ);
149
150 int read_prob(char *fname, int *pn, int *pk, struct blockmatrix *pC,
151               double **pa, struct constraintmatrix **pconstraints,
152               int printlevel);
153
154 int write_prob(char *fname, int n, int k, struct blockmatrix C,
155                double *a, struct constraintmatrix *constraints);
156
157 int write_sol(char *fname, int n, int k, struct blockmatrix X,
158               double *y, struct blockmatrix Z);
159
160 void free_prob(int n, int k, struct blockmatrix C, double *a, 
161                struct constraintmatrix *constraints, struct blockmatrix X,
162                double *y, struct blockmatrix Z);
163
164 int sdp(int n, int k, struct blockmatrix C, double *a, double constant_offset,
165         struct constraintmatrix *constraints, struct sparseblock **byblocks,
166         struct constraintmatrix fill, struct blockmatrix X, double *y, 
167         struct blockmatrix Z, struct blockmatrix cholxinv,
168         struct blockmatrix cholzinv, double *pobj, double *dobj, 
169         struct blockmatrix work1, struct blockmatrix work2,     
170         struct blockmatrix work3,
171         double *workvec1, double *workvec2,
172         double *workvec3, double *workvec4, double *workvec5,
173         double *workvec6, double *workvec7, double *workvec8, 
174         double *diagO, struct blockmatrix bestx, double *besty,
175         struct blockmatrix bestz, struct blockmatrix Zi, double *O,
176         double *rhs, struct blockmatrix dZ, struct blockmatrix dX, 
177         double *dy, double *dy1, double *Fp, int nfree, int *freevarblocks,
178         int *freevarin, int printlevel, struct paramstruc parameters);
179
180 int easy_sdp(int n, int k, struct blockmatrix C, double *a, 
181              struct constraintmatrix *constraints, double constant_offset,
182              struct blockmatrix *pX, double **py, struct blockmatrix *pZ,
183              double *ppobj, double *pdobj);
184
185 void tweakgap(int n, int k, double *a, struct constraintmatrix *constraints,
186               double gap, struct blockmatrix Z, struct blockmatrix dZ, 
187               double *y, double *dy, struct blockmatrix work1, 
188               struct blockmatrix work2, struct blockmatrix work3, 
189               struct blockmatrix work4, double *workvec1, double *workvec2,
190               double *workvec3, double *workvec4, int printlevel);
191
192 int bisect_(int *n, double *eps1, double *d, double *e, double *e2,
193             double *lb, double *ub, int *mm, int *m, double *w, int *ind, 
194             int *ierr, double *rv4, double *rv5);
195
196 /*
197   BLAS and LINPACK stuff.
198   */
199
200 /*
201   First, BLAS routines.
202  */
203
204 #ifdef CAPSBLAS
205 #ifdef NOUNDERBLAS
206 double DNRM2();
207 double DASUM();
208 double DDOT();
209 int IDAMAX();
210 void DGEMM();
211 void DGEMV();
212 void DGER();
213 void DTRSM();
214 void DTRMV();
215 #else
216 double DNRM2_();
217 double DASUM_();
218 double DDOT_();
219 int IDAMAX_();
220 void DGEMM_();
221 void DGEMV_();
222 void DGER_();
223 void DTRSM_();
224 void DTRMV_();
225 #endif
226 #else
227 #ifdef NOUNDERBLAS
228 double dnrm2();
229 double dasum();
230 double ddot();
231 int idamax();
232 void dgemm();
233 void dgemv();
234 void dger();
235 void dtrsm();
236 void dtrmv();
237 #else
238 double dnrm2_();
239 double dasum_();
240 double ddot_();
241 int idamax_();
242 void dgemm_();
243 void dgemv_();
244 void dger_();
245 void dtrsm_();
246 void dtrmv_();
247 #endif
248 #endif
249
250 /*
251   LAPACK next.
252  */
253
254 #ifdef CAPSLAPACK
255 #ifdef NOUNDERLAPACK
256 void DPOTRF();
257 void DPOTRS();
258 void DPOTRI();
259 void DTRTRI();
260 #else
261 void DPOTRF_();
262 void DPOTRS_();
263 void DPOTRI_();
264 void DTRTRI_();
265 #endif
266 #else
267 #ifdef NOUNDERLAPACK
268 void dpotrf();
269 void dpotrs();
270 void dpotri();
271 void dtrtri();
272 #else
273 void dpotrf_();
274 void dpotrs_();
275 void dpotri_();
276 void dtrtri_();
277 #endif
278 #endif
279
280