public void Go5() { var itt = new CombinationIterator(2, 4); int i = 0; foreach (var it in itt) { Console.WriteLine($"{i}: {string.Join(",", it)}"); i++; } }
public void Go3() { var it = new CombinationIterator(8, 64); int i = 0; foreach (var a in it) { Console.WriteLine($"{i}: {string.Join(",", a)}"); i++; } }
public void Go4() { //for (int i = 8; i < 64; i++) //{ // var w = Stopwatch.StartNew(); // var itt = new CombinationIterator(8, i); // var data = itt.ToList(); // w.Stop(); // Console.WriteLine($"{i}: duration: {w.Elapsed} length: {data.Count}"); //} var it = new CombinationIterator(8, coords.Count); var destVectorRichtingFoenestra = new Sv(expectedValues[0], expectedValues[1], expectedValues[2]); var destVectorTerug = new Sv(-expectedValues[0], -expectedValues[1], -expectedValues[2]); var dest = destVectorRichtingFoenestra; var summedList = it .Select(t => new { ItemsToSelect = it, Data = coords.GetElementsAt(t) }) .Select(t => new { ItemsToSelect = t.ItemsToSelect, Data = t.Data, Sum = SumSv(t.Data) }) .OrderBy(t => DistTwoVectors(dest, t.Sum.Normalized)) .ToList(); var testestje = coords.GetElementsAt(Enumerable.Range(0, 8)).ToList(); var sum = SumSv(testestje); var norm = sum.Normalized; var sb = new StringBuilder(); foreach (var val in summedList) { var line = $"{val.Sum.Normalized} ({DistTwoVectors(dest, val.Sum.Normalized)}) {val.Sum} ({string.Join(",", val.Data)})"; sb.AppendLine(line); //Console.WriteLine(line); } File.WriteAllText("Outputje123123.txt", sb.ToString()); }