isl_param_util.c: drop expr2vertex
[barvinok.git] / zsolve / libzsolve.h
blob6d305df5052bb8ebc201cf72871c6df21f8273e9
1 /*
2 4ti2 -- A software package for algebraic, geometric and combinatorial
3 problems on linear spaces.
5 Copyright (C) 2006 4ti2 team.
6 Main author(s): Matthias Walter.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef _LIBZSOLVE_H
24 #define _LIBZSOLVE_H
26 #include "vectorarray.h"
27 #include "linearsystem.h"
28 #include "cputime.h"
30 /*** solve-internal data ***/
32 typedef struct zsolvecontext_t
34 int Current;
35 int Variables;
36 int SumNorm;
37 int FirstNorm;
38 int SecondNorm;
40 VectorArray Lattice;
42 VectorArray Homs;
43 VectorArray Inhoms;
44 VectorArray Frees;
45 VectorArray Graver;
47 int MaxNorm;
48 void **Norm;
49 Vector First;
50 Vector Second;
51 Vector Sum;
53 bool Symmetric;
55 FILE *LogFile;
56 int LogLevel;
57 int Verbosity;
59 CPUTime AllTime;
60 CPUTime VarTime;
61 CPUTime SumTime;
62 CPUTime NormTime;
64 int BackupTime;
66 void (*LogCallback)(FILE *, int level, int type, int var, int sum, int norm, int vectors, CPUTime alltime, CPUTime steptime);
67 void (*BackupCallback)(struct zsolvecontext_t *);
68 } zsolvecontext_t;
69 typedef zsolvecontext_t *ZSolveContext;
72 /*** logging ***/
74 #define ZSOLVE_LOG_STARTED 0
75 #define ZSOLVE_LOG_RESUMED 1
76 #define ZSOLVE_LOG_VARIABLE_STARTED 2
77 #define ZSOLVE_LOG_VARIABLE_FINISHED 3
78 #define ZSOLVE_LOG_SUM_STARTED 4
79 #define ZSOLVE_LOG_SUM_FINISHED 5
80 #define ZSOLVE_LOG_NORM_STARTED 6
81 #define ZSOLVE_LOG_NORM_FINISHED 7
82 #define ZSOLVE_LOG_FINISHED 8
84 typedef void (*ZSolveLogCallback)(FILE *, int level, int type, int var, int sum, int norm, int vectors, CPUTime alltime, CPUTime steptime);
85 /* (stream, loglevel, log_type, current variable, current sum, current norm, number of vectors, cumulative time, time of logged step) */
87 void zsolveLogCallbackDefault(FILE *, int, int, int, int, int, int, CPUTime, CPUTime);
88 /* (stream, loglevel, log_type, current variable, current sum, current norm, number of vectors, cumulative time, time of logged step) */
90 /*** backup ***/
92 typedef void (*ZSolveBackupCallback)(ZSolveContext);
93 /* (pass context to backupZSolveContext after initializing the file) */
95 void backupZSolveContext(FILE *, ZSolveContext);
96 /* (backupfile, current context) */
98 /*** main calls ***/
99 ZSolveContext createZSolveContextFromSystem(LinearSystem, FILE *, int, int, ZSolveLogCallback, ZSolveBackupCallback);
100 /* (system to solve, logfile, loglevel = 0..3, verbosity = 0..3, custom log callback or zsolveLogCallbackDefault, backup callback) */
102 ZSolveContext createZSolveContextFromLattice(VectorArray, FILE *, int, int, ZSolveLogCallback, ZSolveBackupCallback);
103 /* (lattice, logfile, loglevel = 0..3, verbosity = 0..3, custom log callback or zsolveLogCallbackDefault, backup callback) */
105 ZSolveContext createZSolveContextFromBackup(FILE *, ZSolveLogCallback, ZSolveBackupCallback);
106 /* (open backup file, custom log callback or zsolveLogCallbackDefault, backup callback) */
108 void zsolveSystem(ZSolveContext, bool);
109 /* (context created by createZSolveContext or resumeZSolveContext, append negatives? should be true for system/lattice, false for resume) */
111 void deleteZSolveContext(ZSolveContext, bool);
112 /* (context, delete Hom and Inhom?) */
114 #endif