sparse_test.m

Go to the documentation of this file.
00001 disp("\n----------- Tests on Sparse Matrix ------------");
00002 fname = "sparse_double_matrix_test";
00003 m = 3;
00004 n = 3;
00005 mati = sprand(m, n, 0.2) * 100;
00006 expected = mati + spones(mati);
00007 nnzi = nnz(mati);
00008 nnzo = nnzi;
00009 
00010 
00011 disp("\nThe input sparse matrix is:");
00012 disp(mati);
00013 
00014 disp("\nCalling sparse_double_matrix_test...");
00015 [mato] = gs_call(fname, nnzi, mati, nnzo, m, n);
00016 disp("Finishing the call...");
00017 
00018 disp("\nThe result sparse matrix (non-zero elements) is:");
00019 disp(mato);
00020 
00021 if (mato == expected)
00022     disp("\nSparse double matrix test passed.\n");
00023 else
00024     disp("\nSparse double matrix test failed.\n");
00025 end
00026 
00027 disp("---------------- Tests Done ----------------\n");