Orbiter 2022
Combinatorial Objects
int_matrix.cpp
Go to the documentation of this file.
1// int_matrix.cpp
2//
3// Anton Betten
4//
5// Oct 23, 2013
6
7
8
9
10#include "foundations.h"
11
12
13using namespace std;
14
15
16namespace orbiter {
17namespace layer1_foundations {
18namespace data_structures {
19
20
22{
23 null();
24}
25
27{
28 freeself();
29}
30
32{
33 M = NULL;
34 m = 0;
35 n = 0;
36}
37
39{
40 if (M) {
41 FREE_int(M);
42 }
43 null();
44}
45
46void int_matrix::allocate(int m, int n)
47{
48 freeself();
49 M = NEW_int(m * n);
52}
53
54void int_matrix::allocate_and_init(int m, int n, int *Mtx)
55{
56 freeself();
57 M = NEW_int(m * n);
60 Int_vec_copy(Mtx, M, m * n);
61}
62
63int &int_matrix::s_ij(int i, int j)
64{
65 return M[i * n + j];
66}
67
69{
70 return m;
71}
72
74{
75 return n;
76}
77
79{
81}
82
83}}}
84
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_int(n)
Definition: foundations.h:625
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects