### Question:
DoubleVertexSamples extends Samples<DoubleTensor> { public DoubleTensor getAverages() { return this.samples.stream() .reduce(DoubleTensor.zeros(sampleShape), DoubleTensor::plusInPlace) .divInPlace((double) samples.size()); } DoubleVertexSamples(List<DoubleTensor> samples); DoubleTensor getAverages(); DoubleTensor getVariances(); DoubleTensor getAutocorrelation(long... index); @Override DoubleTensor asTensor();  }### Answer:
@Test public void doesCalculateAverage() { DoubleTensor averages = samples.getAverages(); double[] expectedValues = stats.stream().mapToDouble(SummaryStatistics::getMean).toArray(); assertThat(averages.asFlatDoubleArray(), equalTo(expectedValues)); assertThat(averages.asFlatDoubleArray(), equalTo(new double[]{2.0, 2.0, 7.0})); }