@@ -12,35 +12,35 @@ public class SparsityTest {
1212 @ Test
1313 public void testAllZeroElements () {
1414 double [][] mat = {{0 , 0 , 0 }, {0 , 0 , 0 }, {0 , 0 , 0 }};
15- double expectedSparsity = 1.0 ; // All elements are zero
15+ double expectedSparsity = 1.0 ;
1616 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of a matrix with all zero elements should be 1.0" );
1717 }
1818
1919 @ Test
2020 public void testNoZeroElements () {
2121 double [][] mat = {{1 , 2 , 3 }, {4 , 5 , 6 }, {7 , 8 , 9 }};
22- double expectedSparsity = 0.0 ; // No zero elements
22+ double expectedSparsity = 0.0 ;
2323 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of a matrix with no zero elements should be 0.0" );
2424 }
2525
2626 @ Test
2727 public void testMixedElements () {
2828 double [][] mat = {{0 , 2 , 0 }, {4 , 0 , 6 }, {0 , 8 , 0 }};
29- double expectedSparsity = 5.0 / 9.0 ; // 5 out of 9 elements are zero
29+ double expectedSparsity = 5.0 / 9.0 ;
3030 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of the matrix should be 5/9" );
3131 }
3232
3333 @ Test
3434 public void testSingleRowMatrix () {
3535 double [][] mat = {{0 , 1 , 0 , 2 , 0 }};
36- double expectedSparsity = 3.0 / 5.0 ; // 3 out of 5 elements are zero
36+ double expectedSparsity = 3.0 / 5.0 ;
3737 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of the single-row matrix should be 3/5" );
3838 }
3939
4040 @ Test
4141 public void testSingleColumnMatrix () {
4242 double [][] mat = {{1 }, {0 }, {0 }, {2 }};
43- double expectedSparsity = 2.0 / 4.0 ; // 2 out of 4 elements are zero
43+ double expectedSparsity = 2.0 / 4.0 ;
4444 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of the single-column matrix should be 2/4" );
4545 }
4646
@@ -53,14 +53,14 @@ public void testEmptyMatrix() {
5353 @ Test
5454 public void testMatrixWithSingleElementZero () {
5555 double [][] mat = {{0 }};
56- double expectedSparsity = 1.0 ; // Only one element which is zero
56+ double expectedSparsity = 1.0 ;
5757 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of a matrix with a single zero element should be 1.0" );
5858 }
5959
6060 @ Test
6161 public void testMatrixWithSingleElementNonZero () {
6262 double [][] mat = {{5 }};
63- double expectedSparsity = 0.0 ; // Only one element which is non-zero
63+ double expectedSparsity = 0.0 ;
6464 assertEquals (expectedSparsity , Sparsity .sparsity (mat ), DELTA , "Sparsity of a matrix with a single non-zero element should be 0.0" );
6565 }
6666}
0 commit comments