3 /* Copyright (c) 1994 Stanford University
7 This software is provided under the terms described in
8 the "suif_copyright.h" include file. */
10 #include <suif_copyright.h>
12 #define _MODULE_ "libsuifmath.a"
13 #pragma implementation "coeff.h"
19 coeff
*coeff::copy() const {
20 coeff
*new_coeff
= new coeff
;
22 new_coeff
->constant
= new int[m
];
23 new_coeff
->vars
= new int[n
*m
];
24 new_coeff
->n
= n
; new_coeff
->m
= m
;
25 memcpy(new_coeff
->constant
, constant
, m
*sizeof(int));
26 memcpy(new_coeff
->vars
, vars
, n
*m
*sizeof(int));
31 void coeff::print(FILE * fp
) const
33 for(int i
=0; i
<m
; i
++) {
34 fprintf(fp
, "%3d", constant
[i
]);
35 for(int j
=0; j
<n
; j
++)
36 fprintf(fp
, "%3d", vars
[i
*n
+j
]);