polylib: update
[barvinok.git] / zsolve / vector.h
blobf7c83b5af372affbe5a932aa219be2ef1af4be22
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 _VECTOR_H
24 #define _VECTOR_H
26 #include <stdio.h>
28 #include "defs.h"
30 typedef int vector_t;
31 typedef vector_t *Vector;
33 Vector createVector(int);
34 /* Allocate memory (size) */
36 Vector createZeroVector(int);
37 /* Allocate memory and fill it with zeros */
39 void deleteVector(Vector);
40 /* Free memory (vector) */
42 Vector copyVector(Vector, int);
43 /* Allocate memory and copy from a given vector (given vector, size) */
45 void fprintVector(FILE *, Vector, int);
46 /* Print to stream (stream, vector, size) */
48 void printVector(Vector, int);
49 /* Print to stdout (vector, size) */
51 Vector readVector(FILE *, int);
52 /* Read from stream (stream, size) */
54 int normVector(Vector, int);
55 /* L1-norm (vector, size) */
57 void swapVector(Vector, int, int);
58 /* Swap vector[a] and vector[b] (vector, a, b) */
60 int gcdVector(Vector, int);
61 /* gcd of all numbers (vector, size) */
63 int lexCompareInverseVector(Vector, int);
64 /* lexicographically compare vector and its inverse */
66 #endif