Example #1
0
        public void ZerosetTest()
        {
            const int length = 15;

            float[] v  = (new float[length]).Select((_, idx) => (float)idx).ToArray();
            float[] v2 = new float[length];
            float[] v3 = (new float[length]).Select((_, idx) => idx < (float)(length - 1) ? 0 : (float)idx).ToArray();
            float[] v4 = (new float[length]).Select((_, idx) => idx >= 3 && idx < (float)(length - 1) ? 0 : (float)idx).ToArray();

            float[] v5 = new float[length];

            AvxArray <float> arr = new AvxArray <float>(length);

            arr.Write(v, length);
            arr.Zeroset();
            arr.Read(v5, length);
            CollectionAssert.AreEqual(v2, v5);

            arr.Write(v, length);
            arr.Zeroset(length - 1);
            arr.Read(v5, length);
            CollectionAssert.AreEqual(v3, v5);

            arr.Write(v, length);
            arr.Zeroset(3, length - 4);
            arr.Read(v5, length);
            CollectionAssert.AreEqual(v4, v5);
        }
Example #2
0
        public void WriteReadTest()
        {
            const int length = 15;

            float[] v  = (new float[length]).Select((_, idx) => (float)idx).ToArray();
            float[] v2 = new float[length];

            AvxArray <float> arr  = new AvxArray <float>(length);
            AvxArray <float> arr2 = new AvxArray <float>(length);

            arr.Write(v);

            AvxArray <float> .Copy(arr, arr2, length);

            arr2.Read(v2);

            CollectionAssert.AreEqual(v, v2);
        }