% Here we compute the SVD of the sparse tomographic measurement matrix A 
% using full matrix algorithms. This is not very efficient coding, and it 
% is done only for educational purposes.
%
% The following routine must be run before this file: XRM1_matrix_comp.m.
%
% Samuli Siltanen February 2012

% Choose resolution
N = 50;

% Load precomputed results at resolution N
loadcommand = ['load data/RadonMatrix', num2str(N), ' A measang target N P Nang'];
eval(loadcommand)

% Compute SVD of A using full matrix algorithms
[U,D,V] = svd(full(A));
D       = sparse(D);

% Save the result to file (with filename containing the resolution N)
savecommand = ['save data/XRME_SVD', num2str(N), ' U D V A measang target N P Nang'];
eval(savecommand)

% View the results
XRM5_SVD_plot(N)
