File: genrestrict.m

package info (click to toggle)
combblas 2.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 190,476 kB
  • sloc: cpp: 55,912; ansic: 25,134; sh: 3,691; makefile: 548; csh: 66; python: 49; perl: 21
file content (14 lines) | stat: -rw-r--r-- 420 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function genrestrict(scale)

% generate restriction operation for multigrid
% or similarly the S matrix for graph contraction

size = 2^scale;
order = 2;	% interpolation order
while (order < 10)
	rhs = size/order;	% interpolation order
	name = ['galerkin_scale', num2str(scale), '_order', num2str(order)];
	A = sprand(size, rhs, order/size);	% approximatly 'size' nonzeros
	writematrix(A, name);
	order = order * 2;
end