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

Method setUp

JSAT/test/jsat/linear/ShiftedVecTest.java:49–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 }
48
49 @Before
50 public void setUp()
51 {
52 a_base = new SparseVector(12, 6);
53 a_base.set(0, 1.0);
54 a_base.set(1, 2.0);
55 a_base.set(3, -2.0);
56 a_base.set(4, 5.0);
57 a_base.set(8, -3.0);
58 a_base.set(11, 1.0);
59
60 b_base = new SparseVector(12, 6);
61 b_base.set(0, 1.0);
62 b_base.set(1, -2.0);
63 b_base.set(3, -3.0);
64 b_base.set(4, 4.0);
65 b_base.set(7, -2.0);
66 b_base.set(10, 1.0);
67
68 shift_a = -1;
69 shift_b = 2;
70
71 a_dense = new DenseVector(a_base);
72 a_sparse = new SparseVector(a_base);
73
74 a_dense.mutableAdd(shift_a);
75 a_sparse.mutableAdd(shift_a);
76
77 b_dense = new DenseVector(b_base);
78 b_sparse = new SparseVector(b_base);
79
80 b_dense.mutableAdd(shift_b);
81 b_sparse.mutableAdd(shift_b);
82
83 Random rand = RandomUtil.getRandom();
84 rand_x = new DenseVector(a_base.length());
85 rand_y = new DenseVector(a_base.length());
86
87 for(int i =0 ; i < rand_x.length(); i++)
88 {
89 rand_x.set(i, Math.round(rand.nextDouble()*10));
90 rand_y.set(i, Math.round(rand.nextDouble()*10));
91 }
92 }
93
94 @After
95 public void tearDown()

Callers

nothing calls this directly

Calls 5

getRandomMethod · 0.95
setMethod · 0.45
mutableAddMethod · 0.45
lengthMethod · 0.45
nextDoubleMethod · 0.45

Tested by

no test coverage detected