private static void Clip_Inner(UniformDistributionSampler sampler, int len) { // Alloc array and fill with uniform random noise. float[] x = new float[len]; sampler.Sample(x); // Clip the elements of the array with the safe routine. float[] expected = (float[])x.Clone(); PointwiseClip(expected, -1.1f, 18.8f); // Clip the elements of the array. float[] actual = (float[])x.Clone(); MathSpan.Clip(actual, -1.1f, 18.8f); // Compare expected with actual array. Assert.True(SpanUtils.Equal <float>(expected, actual)); }
private static void Clip_Inner(ISampler <int> sampler, int len) { // Alloc array and fill with uniform random noise. int[] x = new int[len]; sampler.Sample(x); // Clip the elements of the array with the safe routine. int[] expected = (int[])x.Clone(); PointwiseClip(expected, -1, 18); // Clip the elements of the array. int[] actual = (int[])x.Clone(); MathSpan.Clip(actual, -1, 18); // Compare expected with actual array. Assert.True(SpanUtils.Equal <int>(expected, actual)); }