function block_gcrodr_examples
    load('sherman5.mat');
    n = size(A,1);
    B = rand(n,3);
    
    testShortTimeInterval = 1;
    testMediumTimeInterval = 3;
    testLongTimeInterval = 6;
    
    %% PREAMBLE
    fprintf('Thank you for downloading our block GCRO-DR code!\n\n');
    pause(testMediumTimeInterval);
    fprintf('The following is a series of example runs of our code\nto demonstrate how one can use our codes.\n\n');
    pause(testMediumTimeInterval);
    fprintf('Please cite this code and the associated paper\nif you use them in your work.\n\n');
    pause(testMediumTimeInterval);
    fprintf('All examples use the sherman5 matrix from\nthe Univ. Florida Sparse Matrix library\nand 3 random right-hand sides.\n\n');
    pause(testLongTimeInterval);clc
    
    %% EXAMPLE 1
    fprintf('Example 1: No options or preconditioning.\nMethod at a minimum requires only A and B.\nAll other parameters have defaults\n\n');pause(testMediumTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B)\n\n');pause(testShortTimeInterval);
    [~,out]=block_gcrodr(A,B);
    semilogy(out.resvecFro); set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    pause(testLongTimeInterval);clc; close all;
    
    %% EXAMPLE 2
    fprintf('Example 2: Options\nAll other options can be set in an options structure.\n');
    fprintf('See documentation for full set of options.\n');
    fprintf('Here we set recycle space size and cycle length.\n\n');pause(testMediumTimeInterval);
    fprintf('>> opts.m = 100; %%cycle length\n');pause(testShortTimeInterval);
    fprintf('>> opts.k = 20; %%recycled subspace dimension\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B,opts)\n\n');pause(testShortTimeInterval);
    opts.m = 100;
    opts.k = 20;
    [~,out]=block_gcrodr(A,B,opts);
    semilogy(out.resvecFro); set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    pause(testLongTimeInterval);clc; close all; clear opts;
    
    %% EXAMPLE 3
    fprintf('Example 3: Frobenius and 2-norm residuals available.\n');
    fprintf('These results come from Experiment 2.\n');
    fprintf('Located in the out structure.\nSee documenation for full output list.\n\n');pause(testMediumTimeInterval);
    fprintf('>> opts.m = 100; %%cycle length\n');pause(testShortTimeInterval);
    fprintf('>> opts.k = 20; %%recycled subspace dimension\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B,opts)\n\n');pause(testShortTimeInterval);
    pause(testMediumTimeInterval);
    fprintf('>> semilogy(out.resvecFro, ''k''); hold on;\n>>semilogy(out.resvec2norm(:,1), ''r-'');\n>>semilogy(out.resvec2norm(:,2), ''r-.'');\n>>semilogy(out.resvec2norm(:,3), ''r--'');\n\n');pause(testMediumTimeInterval);
    semilogy(out.resvecFro, 'k'); hold on; semilogy(out.resvec2norm(:,1), 'r-'); semilogy(out.resvec2norm(:,2), 'r-.'); semilogy(out.resvec2norm(:,3), 'r--'); hold off;   set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    pause(testLongTimeInterval);clc; close all; clear opts;
    
    %% EXAMPLE 4
    fprintf('Example 4: Enlarging block size with additional vectors.\n');
    fprintf('One can specify additional vectors, which\nin addition to the residual are used to build\nthe block Krylov subspace.\n\n');pause(testMediumTimeInterval);
    fprintf('>> opts.m = 100; %%cycle length\n');pause(testShortTimeInterval);
    fprintf('>> opts.k = 20; %%recycled subspace dimension\n');pause(testShortTimeInterval);
    fprintf('>> opts.Bextra = rand(size(A,1),2); %%extra vectors\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B,opts)\n\n');pause(testShortTimeInterval);
    opts.Bextra = rand(size(A,1),2);
    opts.m = 100;
    opts.k = 20;
    [~,out2]=block_gcrodr(A,B,opts);
    semilogy(out.resvecFro, 'k'); hold on; semilogy(out2.resvecFro, 'r'); hold off; set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    legend('Without additional vectors','With additional vectors');
    pause(testLongTimeInterval);clc; close all; clear opts;
    
    %% EXAMPLE 5
    fprintf('Example 5: Preconditioning.\n');
    fprintf('One can pass a (two) preconditioner(s) as an option.\n\n');pause(testMediumTimeInterval);
    fprintf('>> [opts.M1,opts.M2] = ilu(A);%%ILU split preconditioning\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B,opts)\n\n');pause(testShortTimeInterval);
    [opts.M1,opts.M2] = ilu(A);
    [~,out]=block_gcrodr(A,B,opts);
    pause(testMediumTimeInterval);
    semilogy(out.resvecFro); set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    pause(testLongTimeInterval);clc; close all; clear opts;
    
    %% EXAMPLE 6
    fprintf('Example 6: Providing a recycled subspace.\n');
    fprintf('When applied to sequential problems, the returned\nrecycled subspace can be passed for the subsequent problem.\nHere we solve the same problem twice.\n\n');pause(testMediumTimeInterval);
    fprintf('>> [opts.M1,opts.M2] = ilu(A);%%ILU split preconditioning\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B,opts)\n');pause(testShortTimeInterval);
    [opts.M1,opts.M2] = ilu(A);
    [~,out]=block_gcrodr(A,B,opts);pause(testShortTimeInterval);
    fprintf('>> opts.U = out.U\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(A,B,opts)\n\n');pause(testShortTimeInterval);
    opts.U = out.U;pause(testShortTimeInterval);
    [~,out2]=block_gcrodr(A,B,opts);
    pause(testMediumTimeInterval);
    semilogy(out.resvecFro, 'k'); hold on; semilogy(out2.resvecFro, 'r'); hold off; set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    legend('Without recycling','With recycling');
    pause(testLongTimeInterval);clc; close all; clear opts;
    
    %% EXAMPLE 7
    fprintf('Example 7: Passing arguments for a matvec procedure.\n');
    fprintf('When A is a matvec procedure requiring additional arguments,\nthey can be passed as arguments after opts.\n\n');pause(testMediumTimeInterval);
    fprintf('>> [opts.M1,opts.M2] = ilu(A);%%ILU split preconditioning\n');pause(testShortTimeInterval);
    fprintf('>> Afun = @(x,s,t) s*(A*x) + t*x;\n');pause(testShortTimeInterval);
    fprintf('>> s0 = 4; t0 = 1.17;\n');pause(testShortTimeInterval);
    fprintf('>> [X,out]=block_gcrodr(Afun,B,opts,s0,t0)\n\n');
    [opts.M1,opts.M2] = ilu(A);
    Afun = @(x,s,t) s*(A*x) + t*x;
    s0 = 4; t0 = 1.17;
    [~,out]=block_gcrodr(Afun,B,opts,s0,t0);
    pause(testMediumTimeInterval);
    semilogy(out.resvecFro, 'k');  set(gca,'fontsize',18); xlabel('Number of iterations','interpreter','latex'); ylabel('Relative residual norm','interpreter','latex');
    pause(testLongTimeInterval);clc; close all; clear opts;
    
    %% CITATION
    fprintf('Michael L. Parks, Kirk M. Soodhalter, and Daniel B. Szyld.\n"A Block Recycled GMRES Method with Investigations\ninto Aspects of Solver Performance" 2016\n\n')
end