Skip to content

Instantly share code, notes, and snippets.

@AndreaCrotti
Created January 13, 2010 13:56
Show Gist options
  • Select an option

  • Save AndreaCrotti/276201 to your computer and use it in GitHub Desktop.

Select an option

Save AndreaCrotti/276201 to your computer and use it in GitHub Desktop.
## get the accuracy of the algorithm and plot it nicely
## x = problem size
## y = accuracy (different lines for different problem)
## Plotting should contain also the precision working with the different kind of matrices
function gen_plot(range, acc1, acc2)
xlabel('dimension');
ylabel('accuracy');
## why ignoring extra labels?
legend('alg 1', 'alg 2');
grid on;
## maybe using saveas is better?
plot(range, acc1, acc2)
endfunction
#
dim_range = 2:10:200;
idx = 1;
for dim = dim_range
test_mat = [ tril(rand(dim)) tril(rand(d) + eye(d)) tril(randn(dim)) ];
m1 = tril(rand(dim));
m2 = tril(rand(dim) + eye(dim));
m3 = tril(randn(dim));
y = rand(dim, 1);
acc11(idx) = accuracy(m1, y, b, 1);
acc12(idx) = accuracy(m2, y, b, 1);
acc13(idx) = accuracy(m3, y, b, 1);
acc21(idx) = accuracy(m1, y, b, 2);
acc22(idx) = accuracy(m2, y, b, 2);
acc23(idx) = accuracy(m3, y, b, 2);
idx += 1;
endfor
#gen_plot(range, acc11, acc12, acc13, acc21, acc22, acc23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment