Matrix bcg = bc.getConnectionGraph();
bcg.set(0.1f, 0, 0);
bcg.set(0.2f, 1, 0);
ConnectionCalculatorFullyConnected aws = new AparapiWeightedSumConnectionCalculator();
List<Connections> connections = new ArrayList<>();
connections.add(c1);
ValuesProvider vp = new ValuesProvider();
vp.addValues(c1.getOutputLayer(), i1);
vp.addValues(ol, o);
aws.calculate(connections, vp, ol);
// most simple case
assertEquals(14, o.get(0, 0), 0);
assertEquals(32, o.get(0, 1), 0);
assertEquals(32, o.get(1, 0), 0);
assertEquals(77, o.get(1, 1), 0);
Util.fillArray(o.getElements(), 0);
// with bias
connections = new ArrayList<>();
connections.add(c1);
connections.add(bc);
vp = new ValuesProvider();
vp.addValues(c1.getOutputLayer(), i1);
vp.addValues(ol, o);
aws = new AparapiWeightedSumConnectionCalculator();
aws.calculate(connections, vp, ol);
assertEquals(14.1, o.get(0, 0), 0.01);
assertEquals(32.1, o.get(0, 1), 0.01);
assertEquals(32.2, o.get(1, 0), 0.01);
assertEquals(77.2, o.get(1, 1), 0.01);
Util.fillArray(o.getElements(), 0);
// combined layers
connections = new ArrayList<>();
connections.add(c1);
connections.add(c2);
connections.add(bc);
vp = new ValuesProvider();
vp.addValues(c1.getOutputLayer(), i1);
vp.addValues(c2.getOutputLayer(), i2);
vp.addValues(ol, o);
aws = new AparapiWeightedSumConnectionCalculator();
aws.calculate(connections, vp, ol);
assertEquals(28.1, o.get(0, 0), 0.01);
assertEquals(64.1, o.get(0, 1), 0.01);
assertEquals(64.2, o.get(1, 0), 0.01);
assertEquals(154.2, o.get(1, 1), 0.01);