barvinok 0.41.7
[barvinok.git] / zsolve / linearsystem.h
blobc71a2b4eec09fe3530ecaac898e28b2a90e0fbac
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 _LINEARSYSTEM_H
24 #define _LINEARSYSTEM_H
26 #include <stdio.h>
27 #include "matrix.h"
28 #include "vector.h"
29 #include "varproperties.h"
31 #define EQUATION_EQUAL 0
32 #define EQUATION_MODULO 1
33 #define EQUATION_LESSER 2
34 #define EQUATION_GREATER 3
35 #define EQUATION_LESSEREQUAL 4
36 #define EQUATION_GREATEREQUAL 5
37 typedef unsigned char EquationType;
39 typedef struct equationproperty_t
41 EquationType Type;
42 /* Type */
44 int Modulus;
45 /* Modulus for congruences */
46 } equationproperty_t;
47 typedef equationproperty_t *EquationProperties;
49 typedef struct linearsystem_t
51 /* Ax = b with equations, inequations, congruences and limitations on variables */
53 int Variables;
54 int Equations;
56 Vector *A;
57 Vector b;
58 VariableProperties VarProperties;
59 EquationProperties EqProperties;
61 } linearsystem_t;
62 typedef linearsystem_t *LinearSystem;
64 LinearSystem createLinearSystem();
65 /* Allocate memory */
67 void deleteLinearSystem(LinearSystem);
68 /* Free memory (system)*/
70 void setLinearSystemSize(LinearSystem, int, int);
71 /* Sets the number of equations and variables (system, variables, equations) */
73 void setLinearSystemMatrix(LinearSystem, Matrix);
74 /* Fills the matrix from a given array (system, matrix) */
76 void setLinearSystemRHS(LinearSystem, Vector);
77 /* Copies the contents from Vector to RHS (system, rhs) */
79 void setLinearSystemLimit(LinearSystem, int, int, int, bool);
80 /* Sets limits for one variable (system, var, lower, upper, free?) */
82 void setLinearSystemBound(LinearSystem, int, char, int);
83 /* Sets limits for one variable (system, var, type, value) */
85 void setLinearSystemEquationType(LinearSystem, int, EquationType, int);
86 /* Sets equation type for one equation (system, id, type, modulus) */
88 void fprintLinearSystem(FILE *, LinearSystem);
89 /* Print to stream (stream, system) */
91 void printLinearSystem(LinearSystem);
92 /* Print to stdout (system) */
94 LinearSystem homogenizeLinearSystem(LinearSystem);
95 /* Create a new homogeneous equation system from a general one */
97 #endif