Esempio n. 1
0
        public static void FloatMax()
        {
            int  m = 300, n = 300, p = 300;
            var  ary2 = AryDeal.floatBuild(0, m * n);
            var  ary3 = AryDeal.floatBuild(0, n * p);
            var  ary4 = new double[m * p];
            long t1   = 0;

            for (var i = 0; i < 120; i++)
            {
                t1 += CSolution.Double_MatrixMulti(ary2, m, n, ary3, p, ary4);
            }
            ValueIn(t1);
        }
Esempio n. 2
0
        private void label23_Click(object sender, EventArgs e)
        {
            Form1.Turbo();
            long tt;
            int  a = int.Parse(textBox9.Text);

            double[] ary1 = AryDeal.floatBuild(0, a * a);
            double[] ary2 = AryDeal.floatBuild(0, a * a);
            double[] ary3 = AryDeal.floatBuild(0, a * a);
            for (int i = 0; i < a * a; ++i)
            {
                ary3[i] = 0;
            }
            tt           = CSolution.Double_MatrixMulti(ary1, a, a, ary2, a, ary3);
            label41.Text = tt.ToString();
        }
Esempio n. 3
0
/*------------------------测试----------------------- */

        public void Single_ThreadTest()//单线程主函数
        {
            testResult = new UIdelegete(SinThreadTestResultFlash);
            var freqRecord = new Queue <int>();

            ThreadControl.MyProcessHigh();
            long gg, t1;//时间记录
            int  x1;

            Form1.Turbo();//提高cpu频率
            //栈操作,38mb考验内存和前端总线
            gg = Ctest.Stack_Test();
            resultRecord.Enqueue(gg);
            //树操作,117kb
            gg = Ctest.Btree_Test();
            resultRecord.Enqueue(gg);
            //pi,39kb
            var ary = new int[10000];

            gg  = CSolution.SuperPi(ary, 10000);
            ary = null;
            resultRecord.Enqueue(gg);
            //随机整数
            CSolution.Int_Test(1, out x1);
            resultRecord.Enqueue(x1);
            freqRecord.Enqueue(crtFreq);
            //归并排序+二分查找,38mb
            var ary1 = AryDeal.intBuild(1, 10000000);

            t1 = TickCount.GetTickCount();
            CSolution.Merge_Sort(ary1, ary1.Length);
            for (var i = 0; i < 100000; ++i)
            {
                CSolution.Mid_Search(ary1, ary1.Length, i);
            }
            t1   = TickCount.GetTickCount() - t1;
            ary1 = null;
            resultRecord.Enqueue(t1);
            freqRecord.Enqueue(crtFreq);
            //泰勒多项式
            gg = CSolution.TalorSeries_Test(100);
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //随机浮点
            CSolution.Float_Test(3, out x1);
            resultRecord.Enqueue(x1);
            freqRecord.Enqueue(crtFreq);
            //双向链表,78kb
            gg = Ctest.Twowaychainlist_Test();
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //单向链表,39kb
            gg = Ctest.Onewaychainlist_Test();
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //队列,156kb
            gg = 0;
            for (var i = 0; i < 101; ++i)
            {
                gg += Ctest.Queue_Test();
            }
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //光照渲染器,2-3mb左右
            gg = CSolution.renderTest(1);
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //2d图像缩放,1kb
            gg = CSolution.imageDeal(1, 1);
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //矩阵整数,1mb
            int m = 300, n = 300, p = 300;
            var ary2 = AryDeal.intBuild(0, m * n);
            var ary3 = AryDeal.intBuild(0, n * p);
            var ary4 = new int[m * p];

            gg = 0;
            for (var i = 0; i < 30; i++)
            {
                gg += CSolution.Int_MatrixMulti(ary2, m, n, ary3, p, ary4);
            }
            ary2 = null;
            ary3 = null;
            ary4 = null;
            resultRecord.Enqueue(gg);
            freqRecord.Enqueue(crtFreq);
            //浮点矩阵
            var ary5 = AryDeal.floatBuild(0, m * n);
            var ary6 = AryDeal.floatBuild(0, n * p);
            var ary7 = new double[m * p];

            gg = 0;
            for (var i = 0; i < 30; i++)
            {
                gg += CSolution.Double_MatrixMulti(ary5, m, n, ary6, p, ary7);
            }
            resultRecord.Enqueue(gg);
            ary5 = null;
            ary6 = null;
            ary7 = null;
            freqRecord.Enqueue(crtFreq);
            gg = 0;
            t1 = freqRecord.Count;
            for (var i = 0; i < t1; ++i)
            {
                gg += freqRecord.Dequeue();
            }
            resultRecord.Enqueue(gg / t1);
            this.Invoke(testResult);
        }