MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testChangeSize

Method testChangeSize

JSAT/test/jsat/linear/DenseMatrixTest.java:1162–1185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1160 }
1161
1162 @Test
1163 public void testChangeSize()
1164 {
1165 DenseMatrix Acpy = A.clone();
1166 Acpy.changeSize(Acpy.rows()-1, Acpy.cols()-1);
1167 assertEquals(Acpy.rows(), A.rows()-1);
1168 assertEquals(Acpy.cols(), A.cols()-1);
1169
1170
1171 for(int i = 0; i < Acpy.rows(); i++)
1172 for(int j = 0; j < Acpy.cols(); j++)
1173 assertEquals(Acpy.get(i, j), A.get(i, j), 0.0);
1174 //Expand back out and make sure the values are zero on the sides
1175 Acpy.changeSize(Acpy.rows()+2, Acpy.cols()+2);
1176 assertEquals(Acpy.rows(), A.rows()+1);
1177 assertEquals(Acpy.cols(), A.cols()+1);
1178
1179 for(int i = 0; i < Acpy.rows(); i++)
1180 for(int j = 0; j < Acpy.cols(); j++)
1181 if(i < A.rows()-1 && j < A.cols()-1)
1182 assertEquals(A.get(i, j), Acpy.get(i, j), 0.0);
1183 else
1184 assertEquals(0.0, Acpy.get(i, j), 0.0);
1185 }
1186}

Callers

nothing calls this directly

Calls 8

changeSizeMethod · 0.95
rowsMethod · 0.95
colsMethod · 0.95
getMethod · 0.95
cloneMethod · 0.65
rowsMethod · 0.45
colsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected