File: info.c

package info (click to toggle)
spooles 2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,012 kB
  • sloc: ansic: 146,834; csh: 3,615; makefile: 2,040; perl: 74
file content (136 lines) | stat: -rw-r--r-- 3,756 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*  info.c  */

#include "../Bridge.h"

/*--------------------------------------------------------------------*/
/*
   --------------------------------------------------------------
   purpose --  generate and return some statistics 
               about the factor and solve

   type -- type of entries
     SPOOLES_REAL or SPOOLES_COMPLEX
   symmetryflag -- symmetry type
     SPOOLES_SYMMETRIC, SPOOLES_HERMITIAN or SPOOLES_NONSYMMETRIC

   on return ---
      *pnfront     -- # of fronts
      *pnfactorind -- # of factor indices
      *pnfactorent -- # of factor entries
      *pnsolveops  -- # of solve operations 
      *pnfactorops -- # of factor operations 

   return values --
      1 -- normal return
     -1 -- bridge is NULL
     -2 -- type is bad, must be SPOOLES_REAL or SPOOLES_COMPLEX
     -3 -- symmetryflag is bad, must be SPOOLES_SYMMETRIC,
           SPOOLES_HERMITIAN or SPOOLES_NONSYMMETRIC
     -4 -- type and symmetryflag mismatch
     -5 -- front tree is not present
     -6 -- pnfront is NULL
     -7 -- pnfactorind is NULL
     -8 -- pnfactorent is NULL
     -9 -- pnsolveops is NULL
    -10 -- pnfactorops is NULL
 
   created -- 98oct01, cca
   --------------------------------------------------------------
*/
int
Bridge_factorStats (
   Bridge   *bridge,
   int      type,
   int      symmetryflag,
   int      *pnfront,
   int      *pnfactorind,
   int      *pnfactorent,
   int      *pnsolveops,
   double   *pnfactorops
) {
ETree   *etree ;
int     nentD, nentU ;
/*
   ---------------
   check the input
   ---------------
*/
if ( bridge == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n bridge is NULL\n") ;
   return(-1) ;
}
switch ( type ) {
case SPOOLES_REAL :
case SPOOLES_COMPLEX :
   break ;
default :
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n bad type %d\n", type) ;
   return(-3) ;
   break ;
}
switch ( symmetryflag ) {
case SPOOLES_SYMMETRIC :
case SPOOLES_HERMITIAN :
case SPOOLES_NONSYMMETRIC :
   break ;
default :
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n bad symmetryflag %d\n", symmetryflag) ;
   return(-3) ;
   break ;
}
if ( type == SPOOLES_REAL && symmetryflag == SPOOLES_HERMITIAN ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n type %d, symmetryflag %d, mismatch\n", 
           type, symmetryflag) ;
   return(-4) ;
}
if ( (etree = bridge->frontETree) == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n front tree is not present\n") ;
   return(-5) ;
}
if ( pnfront == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n pnfront is NULL\n") ;
   return(-6) ;
}
if ( pnfactorind == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n pnfactorind is NULL\n") ;
   return(-7) ;
}
if ( pnfactorent == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n pnfactorent is NULL\n") ;
   return(-8) ;
}
if ( pnsolveops == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n pnsolveops is NULL\n") ;
   return(-9) ;
}
if ( pnfactorops == NULL ) {
   fprintf(stderr, "\n error in Bridge_factorStats()"
           "\n pnfactorops is NULL\n") ;
   return(-10) ;
}
*pnfront     = ETree_nfront(etree) ;
*pnfactorind = ETree_nFactorIndices(etree) ;
*pnfactorent = ETree_nFactorEntries(etree, symmetryflag) ;
*pnfactorops = ETree_nFactorOps(etree, type, symmetryflag) ;
nentD = etree->nvtx ;
nentU = *pnfactorent - nentD ;
switch ( type ) {
case SPOOLES_REAL :
   *pnsolveops = 4*nentU + nentD ;
   break ;
case SPOOLES_COMPLEX :
   *pnsolveops = 16*nentU + 8*nentD ;
   break ;
}
return(1) ; }

/*--------------------------------------------------------------------*/