public unsafe void TestVectorizedUnrolled(FloatGenerator generator) { var(data, stepSize, reproContext) = generator(); var copy = data.ToArray(); fixed(float *dataPtr = ©[0]) { Multiply.MultiplyVectorizedUnrolled(dataPtr, copy.Length, 1 / stepSize); } for (var i = 0; i < copy.Length; i++) { copy[i] *= stepSize; } Assert.That(copy, Is.EqualTo(data).Within(10).Ulps, reproContext); }
public Faker(string dirPath) { List <Assembly> allAssemblies = new List <Assembly>(); foreach (string dll in Directory.GetFiles(dirPath, "*.dll")) { allAssemblies.Add(Assembly.LoadFile(dll)); } collectionTypeGenerator = new Dictionary <string, ICollectionGenerator>(); basicTypeGenerator = new Dictionary <Type, IGenerator>(); var doubleGenerator = new DoubleGenerator(); basicTypeGenerator.Add(doubleGenerator.GetGeneratorType(), doubleGenerator); var uintGenerator = new UIntGenerator(); basicTypeGenerator.Add(uintGenerator.GetGeneratorType(), uintGenerator); var floatGenerator = new FloatGenerator(); basicTypeGenerator.Add(floatGenerator.GetGeneratorType(), floatGenerator); var charGenerator = new CharGenerator(); basicTypeGenerator.Add(charGenerator.GetGeneratorType(), charGenerator); var stringGenerator = new StringGenerator(); basicTypeGenerator.Add(stringGenerator.GetGeneratorType(), stringGenerator); var longGenerator = new LongGenerator(); basicTypeGenerator.Add(longGenerator.GetGeneratorType(), longGenerator); var datetimeGenerator = new DateGenerator(); basicTypeGenerator.Add(datetimeGenerator.GetGeneratorType(), datetimeGenerator); foreach (var asm in allAssemblies) { Console.WriteLine(asm.FullName); var types = asm.GetTypes().Where(t => t.GetInterfaces().Where(i => i.Equals(typeof(IGenerator))).Any()); foreach (var type in types) { var plugin = asm.CreateInstance(type.FullName) as IGenerator; Type t = plugin.GetGeneratorType(); if (!basicTypeGenerator.ContainsKey(t)) { basicTypeGenerator.Add(plugin.GetGeneratorType(), plugin); } } } var listGenerator = new ListGenerator(); collectionTypeGenerator.Add(listGenerator.GetGeneratorType().Name, listGenerator); recursionList = new List <Type>(); }