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
));
44
a->
denominator
=
VALUE_ONE
;
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)
52
void
matrix_rm
(
Pmatrix
a)
53
{
54
if
(a) {
55
free
(a->
coefficients
);
56
free
(a);
57
}
58
}
Value
int Value
Definition:
arithmetique-local.h:296
VALUE_ONE
#define VALUE_ONE
Definition:
arithmetique-local.h:303
arithmetique.h
boolean.h
malloc
void * malloc(YYSIZE_T)
free
void free(void *)
linear_assert.h
matrix_new
Pmatrix matrix_new(int m, int n)
package matrix
Definition:
alloc.c:41
matrix_rm
void matrix_rm(Pmatrix a)
Definition:
alloc.c:52
matrix.h
Pmatrix
package matrice
Definition:
matrix-local.h:63
Pmatrix::coefficients
Value * coefficients
Definition:
matrix-local.h:67
Pmatrix::number_of_lines
int number_of_lines
Definition:
matrix-local.h:65
Pmatrix::number_of_columns
int number_of_columns
Definition:
matrix-local.h:66
Pmatrix::denominator
Value denominator
Definition:
matrix-local.h:64
linear
src
matrix
alloc.c
Generated on Thu Sep 26 2024 22:11:29 for PIPS by
1.9.1