示例#1
0
        static void SecondProblem(VecNd vec, int M)
        {
            int N = vec.Dimension;

            if (bLogging)
            {
                Console.WriteLine(vec.ToString());
            }
            Thread[] threads = new Thread[M];
            for (int i = 0; i < M; i++)
            {
                threads[i] = new Thread(() => {
                    for (int j = i * (N / M); j < (i + 1 != M ? (i + 1) * (N / M) : N); j++)
                    {
                        vec.SetElement(j, Function(vec.Matrix[j], multiplier));
                    }
                });
                threads[i].Start();
                threads[i].Join();
            }
            if (bLogging)
            {
                Console.WriteLine(vec.ToString());
            }
        }
示例#2
0
        static void FirstProblem(VecNd vec)
        {
            int N = vec.Dimension;

            if (bLogging)
            {
                Console.WriteLine(vec.ToString());
            }
            for (int i = 0; i < vec.Dimension; i++)
            {
                vec.SetElement(i, Function(vec.Matrix[i], multiplier));
            }
            if (bLogging)
            {
                Console.WriteLine(vec.ToString());
            }
        }