DSDP
numchol.h
1#include <stdio.h>
2#include <stdlib.h>
3#include <math.h>
4#include <string.h>
5
6typedef enum {
7 CfcOk=0,
8 CfcSpace, /* fail to allocate required space */
9 CfcIndef /* indefinity is detected */
10} cfc_sta;
11
12typedef struct {
13 int mrow; /* number of rows allocated */
14 int nrow; /* number of rows used */
15
16 int snnz; /* number of indices for nonzeros in S */
17 int *shead; /* position of first nonzero in row i of S */
18 int *ssize; /* number of non-zeros in row i of S below */
19 /* the diagonal */
20 int *ssub; /* column index buffer for non-zeros in S */
21 double *diag; /* diagonal matrix D in the factorization */
22 double *sqrtdiag;/* sqrt o diagonal matrix D in the factorization */
23
24 int unnz; /* number of nonzeros in the upper factor */
25 int ujnz; /* number of column indices in the compressed */
26 /* indices buffer ujsub */
27 int *ujbeg; /* beginning position of indices in row i of U */
28 int *uhead; /* position of first nonzero in row i of U */
29 int *ujsze; /* number of indices in row i of U */
30 int *usub; /* compressed column index buffer of U */
31 double *uval; /* nonzero values in factor U */
32
33 int *perm; /* permutation order */
34 int *invp; /* inverse order of perm */
35
36 int nsnds; /* number of supernodes */
37 int *subg; /* index of the first column in supernode i */
38 int ndens; /* numer of dense rows */
39 int nsndn; /* number supernodes in dense rows */
40 int *dhead; /* pointer first column in each dense row */
41 int *dsub; /* indices in dense rows */
42 int *dbeg; /* beginning of column index */
43 int sdens; /* separate dense row */
44
45 int alldense;
46
47 double tolpiv;
48 int cachesize;
49 int cacheunit;
50
51 /* New */
52 int n;
53 int *iw;
54 double *rw;
55 int factor;
56} chfac;
57
58
59typedef struct {
60 int idep;
61 int last;
62 int most;
63 int cure;
64 int loca;
65 int lowp;
66 int ntot;
67
68 int *head;
69 int *port;
70 int *fwrd;
71 int *bwrd;
72 } xlist;
73
74typedef struct {
75 int nnod;
76 int nn0;
77 int raft;
78 int head;
79 int last;
80 int ntot;
81
82 int *adjn;
83 int *rbeg;
84 int *rexs;
85 int *rlen;
86 int *rend;
87 int *pres;
88 int *succ;
89 } order;
90
91typedef enum {
92 OptFound=0,
93 SysError=100,
94 OutOfSpc,CholErr
95} xcode;
96
97#if !defined (min)
98#define min(a,b) ((a <= b)? (a) : (b))
99#endif
100#if !defined (max)
101#define max(a,b) ((a >= b)? (a) : (b))
102#endif
103#if !defined (sign)
104#define sign(a) ((a<0)? (-1) : (1))
105#endif
106#if !defined (TRUE)
107#define TRUE 1
108#endif
109#if !defined (FALSE)
110#define FALSE 0
111#endif
112
113#include "sdpfun.h"