/// <summary> /// Iterate over a matrix (square sized in n dimensions with the dimensions given in int[]) /// A multithreaded approach is used /// </summary> /// <param name="sizeVector">The size of the matrix to be evaluated (the search space)</param> /// <param name="delegateVector">A delegate which will handle each vector</param> public static void MapMatrixMT(int[] sizeVector, DelegateVector delegateVector) { var count = 1; for (var i = 0; i < sizeVector.Length; i++) { count *= sizeVector[i]; } }
/// <summary> /// Iterate over a matrix (square sized in n dimensions with the dimensions given in int[]) /// A singlethreaded approach is used /// </summary> /// <param name="sizeVector">The size of the matrix to be evaluated (the search space)</param> /// <param name="callback">A delegate which will handle each vector</param> public static void MapMatrix(int[] sizeVector, DelegateVector callback) { var count = 1; for (var i = 0; i < sizeVector.Length; i++) { count *= sizeVector[i]; } for (var j = 0; j < count; j++) { callback(j, MatrixVector(j, sizeVector)); } }
/// <summary> /// Map matrix multithreaded. Call the delegate callback for each item in the matrix. /// </summary> /// <param name="sizeVector">Size of the matrix</param> /// <param name="delegateVector">Delegate to execute for each vector</param> public static void MapMatrixMT(Point3i sizeVector, DelegateVector delegateVector) { MapMatrixMT(sizeVector.ToArray(), delegateVector); }