~ubuntu-branches/ubuntu/raring/python-scipy/raring-proposed

« back to all changes in this revision

Viewing changes to Lib/sandbox/pysparse/superlu/util.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-07 14:12:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070107141212-mm0ebkh5b37hcpzn
* Remove build dependency on python-numpy-dev.
* python-scipy: Depend on python-numpy instead of python-numpy-dev.
* Package builds on other archs than i386. Closes: #402783.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __SUPERLU_UTIL /* allow multiple inclusions */
 
2
#define __SUPERLU_UTIL
 
3
 
 
4
#include <stdio.h>
 
5
#include <stdlib.h>
 
6
#include <string.h>
 
7
#include <assert.h>
 
8
 
 
9
/* Macros */
 
10
#ifndef USER_ABORT
 
11
#define USER_ABORT(msg) superlu_abort_and_exit(msg)
 
12
#endif
 
13
 
 
14
#define ABORT(err_msg) \
 
15
 { char msg[256];\
 
16
   sprintf(msg,"%s at line %d in file %s\n",err_msg,__LINE__, __FILE__);\
 
17
   USER_ABORT(msg); }
 
18
 
 
19
 
 
20
#ifndef USER_MALLOC
 
21
#define USER_MALLOC(size) superlu_malloc(size)
 
22
#endif
 
23
 
 
24
#define SUPERLU_MALLOC(size) USER_MALLOC(size)
 
25
 
 
26
#ifndef USER_FREE
 
27
#define USER_FREE(addr) superlu_free(addr)
 
28
#endif
 
29
 
 
30
#define SUPERLU_FREE(addr) USER_FREE(addr)
 
31
 
 
32
 
 
33
#define SUPERLU_MAX(x, y)       ( (x) > (y) ? (x) : (y) )
 
34
#define SUPERLU_MIN(x, y)       ( (x) < (y) ? (x) : (y) )
 
35
 
 
36
/* 
 
37
 * Constants 
 
38
 */
 
39
#define EMPTY   (-1)
 
40
#define NO      (-1)
 
41
#define FALSE   0
 
42
#define TRUE    1
 
43
 
 
44
/*
 
45
 * Type definitions
 
46
 */
 
47
typedef float    flops_t;
 
48
typedef unsigned char Logical;
 
49
 
 
50
/* 
 
51
 * The following enumerate type is used by the statistics variable 
 
52
 * SuperLUStat, to keep track of flop count and time spent at various stages.
 
53
 *
 
54
 * Note that not all of the fields are disjoint.
 
55
 */
 
56
typedef enum {
 
57
    COLPERM, /* find a column ordering that minimizes fills */
 
58
    RELAX,   /* find artificial supernodes */
 
59
    ETREE,   /* compute column etree */
 
60
    EQUIL,   /* equilibrate the original matrix */
 
61
    FACT,    /* perform LU factorization */
 
62
    RCOND,   /* estimate reciprocal condition number */
 
63
    SOLVE,   /* forward and back solves */
 
64
    REFINE,  /* perform iterative refinement */
 
65
    FLOAT,   /* time spent in floating-point operations */
 
66
    TRSV,    /* fraction of FACT spent in xTRSV */
 
67
    GEMV,    /* fraction of FACT spent in xGEMV */
 
68
    FERR,    /* estimate error bounds after iterative refinement */
 
69
    NPHASES  /* total number of phases */
 
70
} PhaseType;
 
71
 
 
72
typedef struct {
 
73
    int     *panel_histo; /* histogram of panel size distribution */
 
74
    double  *utime;       /* running time at various phases */
 
75
    flops_t *ops;         /* operation count at various phases */
 
76
} SuperLUStat_t;
 
77
 
 
78
/* Macros */
 
79
#define FIRSTCOL_OF_SNODE(i)    (xsup[i])
 
80
 
 
81
 
 
82
#ifdef __cplusplus
 
83
extern "C" {
 
84
#endif
 
85
 
 
86
extern void    superlu_abort_and_exit(char*);
 
87
extern void    *superlu_malloc (size_t);
 
88
extern int     *intMalloc (int);
 
89
extern int     *intCalloc (int);
 
90
extern void    superlu_free (void*);
 
91
extern void    SetIWork (int, int, int, int *, int **, int **, int **,
 
92
                         int **, int **, int **, int **);
 
93
extern void    StatInit(int, int);
 
94
extern void    StatFree();
 
95
extern int     sp_coletree (int *, int *, int *, int, int, int *);
 
96
extern void    relax_snode (const int, int *, const int, int *, int *);
 
97
extern void    resetrep_col (const int, const int *, int *);
 
98
extern int     spcoletree (int *, int *, int *, int, int, int *);
 
99
extern int     *TreePostorder (int, int *);
 
100
extern double  SuperLU_timer_ ();
 
101
extern int     sp_ienv (int);
 
102
extern int     lsame_ (char *, char *);
 
103
extern int     xerbla_ (char *, int *);
 
104
extern void    ifill (int *, int, int);
 
105
extern void    snode_profile (int, int *);
 
106
extern void    super_stats (int, int *);
 
107
extern void    PrintSumm (char *, int, int, int);
 
108
extern void    PrintStat (SuperLUStat_t *);
 
109
extern void    print_panel_seg(int, int, int, int, int *, int *);
 
110
extern void    check_repfnz(int, int, int, int *);
 
111
 
 
112
#ifdef __cplusplus
 
113
  }
 
114
#endif
 
115
 
 
116
#endif /* __SUPERLU_UTIL */