Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
                        
        }