public static Test ( string testName, float>.Func |
||
testName | string | |
function | float>.Func | |
benchmarkIterations | int | |
Résultat | void |
public static void Test() { const int iterationCount = 10000000; //Helper.Test("Cross Scalar Old", TestTransformScalarOld, iterationCount); Helper.Test("Cross Scalar", TestTransformScalar, iterationCount); }
public static void Test() { TestBoxRayCorrectness(); const int iterations = 1000000; Helper.Test("Box-Ray SIMD", TestBoxRaySIMD, iterations); Helper.Test("Box-Ray Scalar", TestBoxRayScalar, iterations); }
//public unsafe static void TestInversionCorrectness() //{ // Random random = new Random(5); // for (int iterationIndex = 0; iterationIndex < 1000; ++iterationIndex) // { // bAffineTransform scalar; // AffineTransform simd; // var scalarPointer = (float*)&scalar; // var simdPointer = (float*)&simd; // //Create a guaranteed invertible transform. // scalar.LinearTransform = bMatrix3x3.CreateFromAxisAngle( // bVector3.Normalize(new bVector3( // 0.1f + (float)random.NextDouble(), // 0.1f + (float)random.NextDouble(), // 0.1f + (float)random.NextDouble())), // (float)random.NextDouble()); // scalar.Translation = new bVector3((float)random.NextDouble() * 10, (float)random.NextDouble() * 10, (float)random.NextDouble() * 10); // for (int i = 0; i < 12; ++i) // { // simdPointer[i] = scalarPointer[i]; // } // bAffineTransform.Invert(ref scalar, out scalar); // AffineTransform.Invert(ref simd, out simd); // for (int i = 0; i < 12; ++i) // { // var errorSimd = Math.Abs(simdPointer[i] - scalarPointer[i]); // Assert.IsTrue(errorSimd < 1e-5f); // } // } //} public unsafe static void Test() { Console.WriteLine("AFFINETRANSFORM RESULTS:"); Console.WriteLine($"Size: {sizeof(AffineTransform)}"); //TestMultiplyCorrectness(); //TestInversionCorrectness(); const int iterationCount = 10000000; Helper.Test("Invert SIMD", TestSIMDInvert, iterationCount); //Helper.Test("Invert Scalar", TestScalarInvert, iterationCount); Helper.Test("Multiply SIMD", TestSIMDMultiply, iterationCount); //Helper.Test("Multiply Scalar", TestScalarMultiply, iterationCount); Helper.Test("Transform SIMD", TestSIMDTransform, iterationCount); //Helper.Test("Transform Scalar", TestTransformScalar, iterationCount); }
public static void Test() { Console.WriteLine("MATRIX4x4 RESULTS:"); //TestMultiplyCorrectness(); const int iterationCount = 10000000; Helper.Test("Transpose SIMD", TestSIMDTranspose, iterationCount); Helper.Test("Transpose SIMDscalarpointer", TestSIMDScalarPointerTranspose, iterationCount); //Helper.Test("Transpose Scalar", TestScalarTranspose, iterationCount); Helper.Test("Transpose System", TestSystemTranspose, iterationCount); Helper.Test("Multiply SIMD", TestSIMDMultiply, iterationCount); //Helper.Test("Multiply Scalar", TestScalarMultiply, iterationCount); Helper.Test("Multiply System", TestSystemMultiply, iterationCount); Helper.Test("Transform SIMD", TestSIMDTransform, iterationCount); Helper.Test("TransformTranspose SIMD", TestSIMDTransformTranspose, iterationCount); //Helper.Test("Transform Scalar", TestTransformScalar, iterationCount); Helper.Test("Transform System", TestTransformSystem, iterationCount); }
//public unsafe static void TestInversionCorrectness() //{ // Random random = new Random(5); // for (int iterationIndex = 0; iterationIndex < 1000; ++iterationIndex) // { // bMatrix3x3 scalar; // Matrix3x3 simd; // Matrix3x3 simdScalar; // var scalarPointer = (float*)&scalar; // var simdPointer = (float*)&simd; // var simdScalarPointer = (float*)&simdScalar; // //Create a guaranteed invertible matrix. // scalar = bMatrix3x3.CreateFromAxisAngle( // bVector3.Normalize(new bVector3( // 0.1f + (float)random.NextDouble(), // 0.1f + (float)random.NextDouble(), // 0.1f + (float)random.NextDouble())), // (float)random.NextDouble()); // for (int i = 0; i < 9; ++i) // { // simdScalarPointer[i] = simdPointer[i] = scalarPointer[i]; // } // bMatrix3x3.Invert(ref scalar, out scalar); // Matrix3x3.Invert(ref simd, out simd); // Matrix3x3.Invert(&simdScalar, &simdScalar); // for (int i = 0; i < 9; ++i) // { // var errorSimd = Math.Abs(simdPointer[i] - scalarPointer[i]); // var errorSimdScalar = Math.Abs(simdScalarPointer[i] - scalarPointer[i]); // Assert.IsTrue(errorSimd < 1e-5f); // Assert.IsTrue(errorSimdScalar < 1e-5f); // } // } //} public unsafe static void Test() { Console.WriteLine("MATRIX3x3 RESULTS:"); Console.WriteLine($"Size: {sizeof(Matrix3x3)}"); //TestMultiplyCorrectness(); //TestInversionCorrectness(); const int iterationCount = 10000000; Helper.Test("Invert SIMD", TestSIMDInvert, iterationCount); Helper.Test("Invert SIMDScalar", TestSIMDScalarInvert, iterationCount); //Helper.Test("Invert Scalar", TestScalarInvert, iterationCount); Helper.Test("Transpose SIMD", TestSIMDTranspose, iterationCount); Helper.Test("Transpose SIMDscalarpointer", TestSIMDScalarPointerTranspose, iterationCount); //Helper.Test("Transpose Scalar", TestScalarTranspose, iterationCount); Helper.Test("Multiply SIMD", TestSIMDMultiply, iterationCount); //Helper.Test("Multiply Scalar", TestScalarMultiply, iterationCount); Helper.Test("Transform SIMD", TestSIMDTransform, iterationCount); Helper.Test("TransformTranspose SIMD", TestSIMDTransformTranspose, iterationCount); //Helper.Test("Transform Scalar", TestTransformScalar, iterationCount); }