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

Method testSet

JSAT/test/jsat/linear/ShiftedVecTest.java:163–178  ·  view source on GitHub ↗

Test of set method, of class ShiftedVec.

()

Source from the content-addressed store, hash-verified

161 * Test of set method, of class ShiftedVec.
162 */
163 @Test
164 public void testSet()
165 {
166 System.out.println("set");
167 ShiftedVec a = new ShiftedVec(a_base, shift_a);
168
169 Random rand = RandomUtil.getRandom();
170 for(int round = 0; round < 100; round++)
171 {
172 int indx = rand.nextInt(a.length());
173 double tmp = rand.nextDouble();
174 a.set(indx, tmp);
175 assertEquals(tmp, a.get(indx), 1e-10);
176 assertEquals(tmp-shift_a, a_base.get(indx), 1e-10);
177 }
178 }
179
180 /**
181 * Test of increment method, of class ShiftedVec.

Callers

nothing calls this directly

Calls 6

getRandomMethod · 0.95
lengthMethod · 0.95
setMethod · 0.95
getMethod · 0.95
nextDoubleMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected