-
Notifications
You must be signed in to change notification settings - Fork 1
/
CreateMatrices.m
41 lines (34 loc) · 996 Bytes
/
CreateMatrices.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% Create Mobius inversion matrices in C++ format
%
clear; close all;
addpath src
NLIST = 1:8;
fp = fopen('matrix.cc','w');
for k = 1:2 % Matrix and its inverse
for N = NLIST % Loop over all N
LAMBDA = amat(N, true);
if (k == 1)
fprintf(fp, 'std::vector<std::vector<double> > A%d = \n{', N);
else
fprintf(fp, 'std::vector<std::vector<double> > invA%d = \n{', N);
LAMBDA = inv(LAMBDA);
end
for i = 1:size(LAMBDA,1)
fprintf(fp, '{');
for j = 1:size(LAMBDA,2)
if (j < size(LAMBDA,2))
fprintf(fp, '%d, ', LAMBDA(i,j));
else
fprintf(fp, '%d', LAMBDA(i,j));
end
end
if (i < size(LAMBDA,1))
fprintf(fp, '},\n');
else
fprintf(fp, '}};\n');
end
end
end
end
fclose(fp);