public void MatMulATest(int matTest, int srcTest, int dstTest, float[] expected) { AlignedArray mat = _testMatrices[matTest]; AlignedArray src = _testSrcVectors[srcTest]; AlignedArray dst = _testDstVectors[dstTest]; CpuMathUtils.MatTimesSrc(false, false, mat, src, dst, dst.Size); float[] actual = new float[dst.Size]; dst.CopyTo(actual, 0, dst.Size); Assert.Equal(expected, actual, _matMulComparer); }
public void ZeroMatrixItemsCoreTest(int test, int[] idx, float[] expected) { AlignedArray src = new AlignedArray(8 + 8 * test, _vectorAlignment); src.CopyFrom(_testSrcVectors[test]); CpuMathUtils.ZeroMatrixItems(src, src.Size / 2 - 1, src.Size / 2, idx); float[] actual = new float[src.Size]; src.CopyTo(actual, 0, src.Size); Assert.Equal(expected, actual, _comparer); }
public void MatMulTranPAAddTest(int matTest, int srcTest, int dstTest, float[] expected) { AlignedArray mat = testMatrices[matTest]; AlignedArray src = testSrcVectors[srcTest]; AlignedArray dst = testDstVectors[dstTest]; int[] idx = testIndexArray; CpuMathUtils.MatTimesSrc(true, true, mat, idx, src, 0, 0, 2 + 2 * srcTest, dst, src.Size); float[] actual = new float[dst.Size]; dst.CopyTo(actual, 0, dst.Size); Assert.Equal(expected, actual, comparer); }
public void MatTimesSrcSparseTest(int matTest, int srcTest, int dstTest, float[] expected) { AlignedArray mat = _testMatrices[matTest]; AlignedArray src = _testSrcVectors[srcTest]; AlignedArray dst = _testDstVectors[dstTest]; int[] idx = _testIndexArray; CpuMathUtils.MatrixTimesSource(mat, idx, src, 0, 0, (srcTest == 0) ? 4 : 9, dst, dst.Size); float[] actual = new float[dst.Size]; dst.CopyTo(actual, 0, dst.Size); Assert.Equal(expected, actual, _matMulComparer); }