示例#1
0
        private void Min()
        {
            float[] a = new[]
            {
                1f,
                0f,
                1f,
                2f,
                100f,
                0.1f,
                1234f,
                678.234f,
            };

            float[] b = new[]
            {
                1f,
                1f,
                2f,
                2f,
                10f,
                1f,
                4321f,
                567.123f,
            };

            float[] r = new[]
            {
                1f,
                0f,
                1f,
                2f,
                10f,
                0.1f,
                1234f,
                567.123f,
            };

            Span <float> s = stackalloc float[r.Length];

            NumericsHelpers.Min(a, b, s);

            EqualsApprox(r, s);
        }
示例#2
0
        private void MinByScalar()
        {
            float[] a = new[]
            {
                1f,
                0f,
                1f,
                2f,
                100f,
                0.1f,
                1234f,
                678.234f,
                0.05f,
                0.5f,
                -12.5f,
            };

            float b = 1f;

            float[] r = new[]
            {
                1f,
                0f,
                1f,
                1f,
                1f,
                0.1f,
                1f,
                1f,
                0.05f,
                0.5f,
                -12.5f,
            };

            Span <float> s = stackalloc float[r.Length];

            NumericsHelpers.Min(a, b, s);

            EqualsApprox(r, s);
        }