static void Main() { // In this ADT example there function AAA preforms a mathematical oprtation and is sent as a delegate to TAM. dlgtFunction Func = AAA; // Create a float array Random R = new Random(); float[] A = new float[5000000]; for (int i = 0; i < A.Length; i++) { A[i] = (float)R.NextDouble(); } TAM TamA = new TAM(2); // Set number of worker threads. //GC.Collect(); //Test With TAM TamA.Function(A, Func); //GC.Collect(); //Test Without TAM for (int i = 0; i < A.Length; i++) { A[i] = (float)Math.Sin(Math.Sqrt(Math.Sqrt(A[i] * Math.PI)) * 1.01); } TamA.Dispose(); }
public void Function(float[] Arr, dlgtFunction Func) { this.m_Ready = false; this.m_CurrentOperation = Operation.CostumFunction; this.m_ArrayA4 = Arr; this.m_Func = Func; this.SetIndexArray(Arr.Length); this.GO(); this.m_Ready = true; }