PIPS
alloc.c
Go to the documentation of this file.
1 /*
2 
3  $Id: alloc.c 1669 2019-06-26 17:24:57Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25  /* package matrix */
26 
27 #ifdef HAVE_CONFIG_H
28  #include "config.h"
29 #endif
30 
31 #include <stdlib.h>
32 #include <stdio.h>
33 
34 #include "linear_assert.h"
35 
36 #include "boolean.h"
37 #include "arithmetique.h"
38 
39 #include "matrix.h"
40 
41 Pmatrix matrix_new(int m, int n)
42 {
43  Pmatrix a = (Pmatrix) malloc(sizeof(Smatrix));
45  a->number_of_lines = m;
46  a->number_of_columns = n;
47  a->coefficients = (Value *) malloc(sizeof(Value)*((n*m)));
48  return a;
49 }
50 
51 // ??? should be matrix_free(Pmatrix * a)
53 {
54  if (a) {
55  free(a->coefficients);
56  free(a);
57  }
58 }
int Value
#define VALUE_ONE
void * malloc(YYSIZE_T)
void free(void *)
Pmatrix matrix_new(int m, int n)
package matrix
Definition: alloc.c:41
void matrix_rm(Pmatrix a)
Definition: alloc.c:52
package matrice
Definition: matrix-local.h:63
Value * coefficients
Definition: matrix-local.h:67
int number_of_lines
Definition: matrix-local.h:65
int number_of_columns
Definition: matrix-local.h:66
Value denominator
Definition: matrix-local.h:64