% plots 2d log log plots
clc;
clf;
close all;
f=14;

% n fixed and m is varied
m=100:100:1500;

% timing
h=figure(f+1);
hold on
loglog(m,t1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,t2(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,t3(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,t4(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,t5(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
loglog(m,t6(1,:),'m*-','MarkerFaceColor','m','LineWidth',2);
xlabel('m');
ylabel('Timings (s)');
title('Comparison of timings when n=100 and m is varied')
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

% timing
h=figure(f+2);
hold on
loglog(m,t1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,t2(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,t3(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,t4(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,t5(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
loglog(m,t6(2,:),'m*-','MarkerFaceColor','m','LineWidth',2);
xlabel('m');
ylabel('Timings (s)');
title('Comparison of timings when n=200 and m is varied');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

% accuracy
h=figure(f+3);
hold on
loglog(m,e1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,e2(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,e3(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,e4(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,e5(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
xlabel('m');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
title('Comparison of accuracies when n=100 and m is varied')
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% accuracy
h=figure(f+4);
hold on
loglog(m,e1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,e2(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,e3(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,e4(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,e5(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
xlabel('m');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
title('Comparison of accuracies when n=200 and m is varied');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% uu'-eye
h=figure(f+5);
hold on
loglog(m,orth1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth3(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth5(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth7(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth9(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
xlabel('m');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
title('Comparison of Orthogonality checks when n=100 and m is varied');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% uu'-eye
h=figure(f+6);
hold on
loglog(m,orth1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth3(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth5(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth7(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth9(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=200 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% u'u-eye
h=figure(f+7);
hold on
loglog(m,orth1_1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth3_1(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth5_1(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth7_1(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth9_1(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=100 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% u'u-eye
h=figure(f+8);
hold on
loglog(m,orth1_1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth3_1(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth5_1(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth7_1(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth9_1(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=200 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% vv'-eye
h=figure(f+9);
hold on
loglog(m,orth2(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth4(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth6(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth8(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth10(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=100 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% vv'-eye
h=figure(f+10);
hold on
loglog(m,orth2(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth4(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth6(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth8(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth10(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=200 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% v'v-eye
h=figure(f+11);
hold on
loglog(m,orth2_1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth4_1(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth6_1(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth8_1(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth10_1(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=100 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% v'v-eye
h=figure(f+12);
hold on
loglog(m,orth2_1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth4_1(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth6_1(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth8_1(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth10_1(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when n=200 and m is varied');
xlabel('m');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+13);
hold on
loglog(m,esval1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,esval2(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,esval3(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,esval4(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,esval5(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of errors in singular values when n=100 and m is varied');
xlabel('m');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

h=figure(f+14);
hold on
loglog(m,esval1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,esval2(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,esval3(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,esval4(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,esval5(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of errors in singular values when n=200 and m is varied');
xlabel('m');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % 

% m fixed and n is varied

% timing
h=figure(f+15);
hold on
loglog(m,t7(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,t8(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,t9(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,t10(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,t11(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
loglog(m,t12(1,:),'m*-','MarkerFaceColor','m','LineWidth',2);
xlabel('n');
ylabel('Timings (s)');
title('Comparison of timings when m=100 and n is varied')
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

% timing
h=figure(f+16);
hold on
loglog(m,t7(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,t8(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,t9(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,t10(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,t11(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
loglog(m,t12(2,:),'m*-','MarkerFaceColor','m','LineWidth',2);
xlabel('n');
ylabel('Timings (s)');
title('Comparison of timings when m=200 and n is varied');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

% accuracy
h=figure(f+17);
hold on
loglog(m,e7(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,e8(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,e9(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,e10(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,e11(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
xlabel('n');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
title('Comparison of accuracies when m=100 and n is varied')
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% accuracy
h=figure(f+18);
hold on
loglog(m,e7(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,e8(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,e9(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,e10(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,e11(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
xlabel('n');
ylabel('Accuracies (||U\SigmaV^{T}-A||_\infty)');
title('Comparison of accuracies when m=200 and n is varied');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% uu'-eye
h=figure(f+19);
hold on
loglog(m,orth13(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth15(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth17(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth19(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth21(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
xlabel('n');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
title('Comparison of Orthogonality checks when m=100 and n is varied');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% uu'-eye
h=figure(f+20);
hold on
loglog(m,orth13(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth15(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth17(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth19(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth21(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=200 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||UU^{T}-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% u'u-eye
h=figure(f+21);
hold on
loglog(m,orth13_1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth15_1(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth17_1(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth19_1(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth21_1(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=100 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% u'u-eye
h=figure(f+22);
hold on
loglog(m,orth13_1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth15_1(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth17_1(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth19_1(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth21_1(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=200 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||U^{T}U-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% vv'-eye
h=figure(f+23);
hold on
loglog(m,orth14(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth16(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth18(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth20(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth22(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=100 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% vv'-eye
h=figure(f+24);
hold on
loglog(m,orth14(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth16(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth18(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth20(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth22(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=200 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||VV^{T}-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% v'v-eye
h=figure(f+25);
hold on
loglog(m,orth14_1(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth16_1(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth18_1(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth20_1(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth22_1(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=100 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

% v'v-eye
h=figure(f+26);
hold on
loglog(m,orth14_1(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,orth16_1(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,orth18_1(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,orth20_1(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,orth22_1(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of Orthogonality checks when m=200 and n is varied');
xlabel('n');
ylabel('Orthogonality checks (||V^{T}V-Id||_\infty)');
legend('Built-in function', 'Comb. Built in','Comb. Square','Indirect Method','Direct Method');
grid
axis tight
print(h,'-dpng');

h=figure(f+27);
hold on
loglog(m,esval6(1,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,esval7(1,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,esval8(1,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,esval9(1,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,esval10(1,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of errors in singular values when m=100 and n is varied');
xlabel('n');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');

h=figure(f+28);
hold on
loglog(m,esval6(2,:),'bv-','MarkerFaceColor','b','LineWidth',2);
loglog(m,esval7(2,:),'g^-','MarkerFaceColor','g','LineWidth',2);
loglog(m,esval8(2,:),'ks-','MarkerFaceColor','k','LineWidth',2);
loglog(m,esval9(2,:),'rd-','MarkerFaceColor','r','LineWidth',2);
loglog(m,esval10(2,:),'co-','MarkerFaceColor','c','LineWidth',2);
title('Comparison of errors in singular values when m=200 and n is varied');
xlabel('n');
ylabel('Errors in singular values (||Computed-Actual||_\infty)');
legend('Comb. Built in','Comb. Square','Indirect Method','Direct Method','Francis');
grid
axis tight
print(h,'-dpng');