add isl_multi_aff_to_polylib
[barvinok.git] / zsolve / matrix.h
blobb44d5d440038ec834426c4b30724a352f0755eda
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 _MATRIX_H
24 #define _MATRIX_H
26 #include <stdio.h>
28 typedef struct matrix_t
30 int Width;
31 int Height;
32 int *Data;
33 } matrix_t;
34 typedef matrix_t *Matrix;
36 Matrix createMatrix(int, int);
37 /* Allocate memory (width, height) */
39 Matrix createIdentityMatrix(int);
40 /* Allocate memory and fill with 1's and 0's (size) */
42 void deleteMatrix(Matrix);
43 /* Free memory (matrix)*/
45 Matrix copyMatrix(Matrix);
46 /* Copy a matrix */
48 Matrix readMatrix(FILE *);
49 /* Read from stream (stream) */
51 void fprintMatrix(FILE *, Matrix);
52 /* Print to stream (stream, matrix) */
54 void printMatrix(Matrix);
55 /* Print to stdout (matrix) */
57 void swapMatrixRows(Matrix, int, int);
58 /* Swap rows a and b (matrix, a, b) */
60 void swapMatrixColumns(Matrix, int, int);
61 /* Swap columns a and b (matrix, a, b) */
63 void negateMatrixColumn(Matrix, int);
64 /* Change the sign of a complete column (matrix, column) */
66 void combineMatrixColumns(Matrix, int, int, int);
67 /* Add a factorized sum of a column src to another column dest (matrix, dest, factor, src) */
69 #endif