Project Name File Name Usage Source Code Link
KMLib ParallelSMOSolver.cs Parallel.ForEach(rangePart, (range, loopState) => { for (int i = range.Item1; i < range.Item2; i++) { if (0 < alpha[i] && alpha[i] < C) { for (int j = 0; j < newAlphas.Length; j++) { int alphaIndex = newAlphas[j].Index; errorCache[i] += newAlphas[j].AlphaStep * Product(i, alphaIndex); } errorCache[i] -= delta_b; //old version -errorCache[i] +=t1 * Product(i1, i)+ t2 * Product(i2, i) - delta_b; } } }) Link To Source File
snippets DataParallelism.cs // Loop over the partitions in parallel. Parallel.ForEach(rangePartitioner, (range, loopState) => { // Loop over each range element without a delegate invocation. for (int i = range.Item1; i < range.Item2; i++) { results[i] = source[i] * Math.PI; } Console.WriteLine("complete {0} - {1}", range.Item1, range.Item2); }) Link To Source File