public SimpleTernaryOpTest__MultiplyAddScalarSingle() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Single>, byte>(ref _fld1), ref Unsafe.As <Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <Single> >()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Single>, byte>(ref _fld2), ref Unsafe.As <Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <Single> >()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Single>, byte>(ref _fld3), ref Unsafe.As <Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector128 <Single> >()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetSingle(); } _dataTable = new SimpleTernaryOpTest__DataTable <Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize); }
public SimpleTernaryOpTest__BlendVariableUInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <UInt32>, byte>(ref _fld1), ref Unsafe.As <UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <UInt32> >()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <UInt32>, byte>(ref _fld2), ref Unsafe.As <UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <UInt32> >()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToUInt32("0xFFFFFFFF", 16) : (uint)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <UInt32>, byte>(ref _fld3), ref Unsafe.As <UInt32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector256 <UInt32> >()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToUInt32("0xFFFFFFFF", 16) : (uint)0); } _dataTable = new SimpleTernaryOpTest__DataTable <UInt32, UInt32, UInt32, UInt32>(_data1, _data2, _data3, new UInt32[RetElementCount], LargestVectorSize); }
public SimpleTernaryOpTest__BlendVariableSByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <SByte>, byte>(ref _fld1), ref Unsafe.As <SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <SByte> >()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <SByte>, byte>(ref _fld2), ref Unsafe.As <SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <SByte> >()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <SByte>, byte>(ref _fld3), ref Unsafe.As <SByte, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector128 <SByte> >()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); } _dataTable = new SimpleTernaryOpTest__DataTable <SByte, SByte, SByte, SByte>(_data1, _data2, _data3, new SByte[RetElementCount], LargestVectorSize); }
public SimpleTernaryOpTest__BlendVariableSingle() { Succeeded = true; var random = new Random(); for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); _data3[i] = (float)(((i % 2) == 0) ? -0.0E0 : 1.0E0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Single>, byte>(ref _fld1), ref Unsafe.As <Single, byte>(ref _data1[0]), VectorSize); Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Single>, byte>(ref _fld2), ref Unsafe.As <Single, byte>(ref _data2[0]), VectorSize); Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Single>, byte>(ref _fld3), ref Unsafe.As <Single, byte>(ref _data3[0]), VectorSize); for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); _data3[i] = (float)(((i % 2) == 0) ? -0.0E0 : 1.0E0); } _dataTable = new SimpleTernaryOpTest__DataTable <Single>(_data1, _data2, _data3, new Single[ElementCount], VectorSize); }
public SimpleTernaryOpTest__BlendVariableSByte() { Succeeded = true; var random = new Random(); for (var i = 0; i < ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <SByte>, byte>(ref _fld1), ref Unsafe.As <SByte, byte>(ref _data1[0]), VectorSize); Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <SByte>, byte>(ref _fld2), ref Unsafe.As <SByte, byte>(ref _data2[0]), VectorSize); Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <SByte>, byte>(ref _fld3), ref Unsafe.As <SByte, byte>(ref _data3[0]), VectorSize); for (var i = 0; i < ElementCount; i++) { _data1[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); _data2[i] = (sbyte)(random.Next(sbyte.MinValue, sbyte.MaxValue)); _data3[i] = (sbyte)(((i % 2) == 0) ? -128 : 1); } _dataTable = new SimpleTernaryOpTest__DataTable <SByte>(_data1, _data2, _data3, new SByte[ElementCount], VectorSize); }
public SimpleTernaryOpTest__MultiplySubtractScalarSingle() { Succeeded = true; var random = new Random(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Single>, byte>(ref _fld1), ref Unsafe.As <Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <Single> >()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Single>, byte>(ref _fld2), ref Unsafe.As <Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <Single> >()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(random.NextDouble()); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Single>, byte>(ref _fld3), ref Unsafe.As <Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector128 <Single> >()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (float)(random.NextDouble()); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(random.NextDouble()); } _dataTable = new SimpleTernaryOpTest__DataTable <Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize); }
public SimpleTernaryOpTest__BlendVariableByte() { Succeeded = true; var random = new Random(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Byte>, byte>(ref _fld1), ref Unsafe.As <Byte, byte>(ref _data1[0]), VectorSize); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Byte>, byte>(ref _fld2), ref Unsafe.As <Byte, byte>(ref _data2[0]), VectorSize); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Byte>, byte>(ref _fld3), ref Unsafe.As <Byte, byte>(ref _data3[0]), VectorSize); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (byte)(random.Next(0, byte.MaxValue)); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (byte)(random.Next(0, byte.MaxValue)); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (byte)(((i % 2) == 0) ? 128 : 1); } _dataTable = new SimpleTernaryOpTest__DataTable <Byte, Byte, Byte, Byte>(_data1, _data2, _data3, new Byte[RetElementCount], VectorSize); }
public SimpleTernaryOpTest__MultiplySubtractNegatedDouble() { Succeeded = true; var random = new Random(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Double>, byte>(ref _fld1), ref Unsafe.As <Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <Double> >()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Double>, byte>(ref _fld2), ref Unsafe.As <Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <Double> >()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Double>, byte>(ref _fld3), ref Unsafe.As <Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector256 <Double> >()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new SimpleTernaryOpTest__DataTable <Double, Double, Double, Double>(_data1, _data2, _data3, new Double[RetElementCount], LargestVectorSize); }
public SimpleTernaryOpTest__BlendVariableDouble() { Succeeded = true; var random = new Random(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld1), ref Unsafe.As <Double, byte>(ref _data1[0]), VectorSize); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld2), ref Unsafe.As <Double, byte>(ref _data2[0]), VectorSize); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld3), ref Unsafe.As <Double, byte>(ref _data3[0]), VectorSize); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = (double)(random.NextDouble()); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = (double)(random.NextDouble()); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (double)(((i % 2) == 0) ? -0.0 : 1.0); } _dataTable = new SimpleTernaryOpTest__DataTable <Double, Double, Double, Double>(_data1, _data2, _data3, new Double[RetElementCount], VectorSize); }
public SimpleTernaryOpTest__BlendVariableSingle() { Succeeded = true; var random = new Random(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Single>, byte>(ref _fld1), ref Unsafe.As <Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <Single> >()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Single>, byte>(ref _fld2), ref Unsafe.As <Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <Single> >()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Single>, byte>(ref _fld3), ref Unsafe.As <Single, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector256 <Single> >()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (float)(((i % 2) == 0) ? -0.0 : 1.0); } _dataTable = new SimpleTernaryOpTest__DataTable <Single, Single, Single, Single>(_data1, _data2, _data3, new Single[RetElementCount], LargestVectorSize); }