global omega
global D
global LpU
global v
global w
global n
global h
global sigma

n = 64;
h = 1/64;
omega = 2/3;
sigma = 1;
d = ones(n+1,1);
D = spdiags([((2/h^2) + sigma)*d], 0, n+1, n+1);
D(1,1)= 1;
D(n+1,n+1) = 1;
LpU = spdiags([(1/h^2)*d 0*d (1/h^2)*d], -1:1, n+1, n+1);
LpU(1,2)  = 0;
LpU(n+1,n) = 0;
xj = 0:n;
xj = xj/n;
k = input('input mode number k \n');
m = input('number of iterations m \n');
point = input('global (matrix) relaxation 0 \n pointwise relaxation 1 \n pointwise vectorized relaxation 2 \n');
v = (sin(k*pi*xj))';

w = zeros(n+1,1);

if point == 0
    tic
    for i = 1:m
        relaxG;
    end
    toc
elseif point == 1
    tic
    for i = 1:m
        relaxPt;
    end
    toc
elseif point == 2
    tic
    for i = 1:m
        relaxVPt;
    end
    toc
else
    fprintf('undefined relaxation type \n')
end
