Exemple #1
0
        public bool CalculateAssessment()
        {
            dgAssessment.Refresh();
            try
            {
                int Rows, Columns;//��¼����Ԫ�ص�����������
                Rows = dgAssessment.Rows.Count - 1;
                Columns = dgAssessment.Columns.Count - 1;

                lbState.Visible = true;
                pgBar.Visible = true;

                double[,] X = new double[Rows, Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        if (isNumberic(dgAssessment.Rows[i + 1].Cells[j + 1].Value.ToString(), out X[i, j]))
                           ;
                        else
                            return false;
                    }
                }
                //��һ��
                double[,] S = new double[Rows, Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        //object a=dgChooseSmallIndex.Rows[j].Cells[0].Value;
                        if (dgChooseSmallIndex.Rows[j].Cells[0].Value.ToString().Equals("True"))
                        {
                            S[i, j] = 1 / X[i, j];
                        }
                        else
                            S[i, j] = X[i, j];
                    }
                }
                lbState.Text = "���ڶ�ԭʼ���ݽ��й淶��";
                pgBar.Value = 10;
                //�ڶ���
                double[,] R = new double[Rows, Columns];
                double[] M = new double[Columns];
                double[] m = new double[Columns];
                for (int j = 0; j < Columns; j++)
                {
                    M[j] = S[0, j];
                    m[j] = S[0, j];
                    for (int i = 0; i < Rows; i++)
                    {
                        //object a=dgChooseSmallIndex.Rows[j].Cells[0].Value;
                        if (S[i, j] > M[j])
                        {
                            M[j] = S[i, j];
                        }
                        if (S[i, j] < m[j])
                        {
                            m[j] = S[i, j];
                        }
                    }
                }

                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        //object a=dgChooseSmallIndex.Rows[j].Cells[0].Value;
                        R[i, j] = S[i, j] / m[j];
                    }
                }
                lbState.Text = "���ڼ����ۺ�����ֵ��ȡֵ��Χ";
                pgBar.Value = 25;
                //������
                double ��1 = dbInputFactor��1.Value;
                double[,] T = new double[Rows, Columns];
                double[] wu = new double[Columns];
                T = (double [,])R.Clone();
                for (int j = 0; j < Rows; j++)
                {
                    for (int i = 0; i < Columns; i++)
                    {
                        for (int k = i + 1; k < Columns; k++)
                        {
                            if (T[j, i] < T[j, k])
                            {
                                double temp = T[j, k];
                                T[j, k] = T[j, i];
                                T[j, i] = temp;
                            }
                        }
                    }
                }
                if (radioButton1.Checked)
                { //���ڡ�ǿȨ���Ƕ�������������
                    double temp = 0;
                    for (int i = 0; i < Columns - 2; i++)
                    {
                        wu[i] = Math.Pow(0.5, i + 1);
                        temp += wu[i];
                    }
                    wu[Columns - 2] = wu[Columns - 1] = 0.5 - 0.5 * temp;
                }
                else
                {//���ڡ���Ȩ���Ƕ�������������
                    wu[0] = 0.5;
                    wu[1] = 0.5 - (Columns - 2) * Math.Pow(0.5, Columns - 1);
                    for (int i = 2; i < Columns; i++)
                    {
                        wu[i] = Math.Pow(0.5, Columns - 1);
                    }
                }
                double[,] y = new double[Rows, 2];
                for (int i = 0; i < Rows; i++)
                {
                    double temp0 = 0, temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 1, temp5= 1;
                    for (int j = 0; j < Columns; j++)
                    {
                        temp2 += wu[j] * T[i, Columns - j - 1];
                        temp3 += wu[j] * T[i, j];
                        //temp4 *= Math.Pow();
                        temp4 *= Math.Pow(T[i, Columns - j - 1], 1 / Columns);
                        temp5 *= Math.Pow(T[i, j], 1 / Columns);

                    }
                    temp0 = (��1 * temp2 + (1-��1) * temp4);
                    temp1 = (��1 * temp3 + (1-��1) * temp5);

                    y[i, 0] = temp0;
                    y[i, 1] = temp1;
                }
                lbState.Text = "���ڼ�������̷����ľ�����Ұ";
                pgBar.Value = 45;
                //���IJ�
                double[,] C_L = new double[Rows, Rows];
                double[,] C_U = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = i; j < Rows; j++)
                    {
                        intersection(y[i, 0], y[i, 1], y[j, 0], y[j, 1], out C_L[i, j], out C_U[i, j]);
                    }
                }

                double[,] d = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = i; j < Rows; j++)
                    {
                        if (i == j)
                        {
                            d[i, j] = 0;//���ﲻ֪��������ʲô��˼�����Ұ���0������
                        }
                        else
                        {
                            d[i, j] = d[j, i] = (C_U[i, j] - C_L[i, j]) / (Math.Max(y[i, 1], y[j, 1]) - Math.Min(y[i, 0], y[j, 0]));
                        }
                    }
                }
                lbState.Text = "���ڼ�������̷����ľ���ǿ��";
                pgBar.Value = 70;
                //���岽
                double[,] u = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Rows; j++)
                    {
                        if (i == j)
                        {
                            u[i, j] = 0;
                        }
                        else
                        {
                            double temp = 0;
                            for (int k = 0; k < Rows; k++)
                            {
                                temp += d[i, k];
                            }
                            u[i, j] = d[i, j] / temp;
                        }
                    }
                }
                lbState.Text = "���ڼ��㾺������עϵ������";
                pgBar.Value = 80;
                //������
                double �� = dbInputFactor��.Value;
                double[,] w = new double[Rows, Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        double temp = 0;
                        for (int k = 0; k < Rows; k++)
                        {
                            if (k != i)
                            {
                                temp += R[k, j] * u[i, k];
                            }

                        }
                        w[i, j] = �� * R[i, j] - (1 - ��) * temp;
                    }
                }
                //���߲�
                lbState.Text = "���ڹ���滮���Ⲣ���";
                pgBar.Value = 90;
                double[,] wx = new double[Rows, Columns];//wx��ʾw*:xΪ�ǵ���˼
                //���ڡ�ǿȨ���Ƕ������������͡�ǿȨ���Ƕ�����������������һ���ģ�
                //��Ϊ��wx����wu��õģ���wu�Ѿ�ͨ������������á�
                ToBeOrdered[] orderNumber = new ToBeOrdered[Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {//�ȸ�ֵ
                        orderNumber[j].Index = j;
                        orderNumber[j].Value = w[i, j];
                    }
                    for (int j = 0; j < Columns; j++)
                    {//������
                        for (int k = j + 1; k < Columns; k++)
                        {
                            if (orderNumber[j].Value < orderNumber[k].Value)
                            {
                                ToBeOrdered temp = orderNumber[k];
                                orderNumber[k] = orderNumber[j];
                                orderNumber[j] = temp;
                            }
                        }

                    }
                    for (int j = 0; j < Columns; j++)
                    {//������
                        wx[i, orderNumber[j].Index] = wu[j];
                    }
                }
                //�ڰ˲�
                double[,] Y = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Rows; j++)
                    {
                        double  temp = 0, temp6 = 0, temp7 = 1;
                        for (int k = 0; k < Columns; k++)
                        {
                            //temp += wx[j, k] * R[i, k];

                            temp6 += wx[j, k] * R[i, k];
                            temp7 *= Math.Pow(R[i, k], 1 / Columns);

                        }
                        //Y[i, j] = temp;
                        temp = (��1 * temp6 + (1-��1) * temp7);
                        Y[i, j] = temp;

                    }
                }
                //�ھŲ�
                //������������������
                double[,] Y1 = new double[Rows, Rows];//���
                double[,] Y2 = new double[Rows, Rows];//�Ҳ�
                double[,] Y3 = new double[Rows, Rows];//���
                Y1 =(double [,]) Y.Clone();
                for (int i = 0; i < Rows; i++)
                {//����ת�þ���
                    for (int j = 0; j < Rows; j++)
                    {
                        Y2[i, j] = Y1[j, i];
                    }
                }
                for (int i = 0; i < Rows; i++)
                {//����Գƾ���
                    for (int j = 0; j < Rows; j++)
                    {
                        double temp = 0;
                        for (int k = 0; k < Rows; k++)
                        {
                            temp += Y1[i, k] * Y2[k, j];
                        }
                        Y3[i, j] = temp;
                    }
                }
                double[] Y4 = new double[Rows*Rows];//���ڼ������
                for (int i = 0; i < Rows; i++)
                {//���Գƾ���ת��Ϊһά����
                    for (int j = 0; j < Rows; j++)
                    {
                        Y4[i*Rows+j] = Y3[i, j];
                    }
                }
                //////////////////////////////////////////
                            // ʵ�Գ����Խ����ȫ������ֵ�����������ļ���
                Matrix mtx16 = new Matrix(Rows, Rows, Y4);

                Matrix mtxQ2 = new Matrix();//���غ�˹�ɶ��±任�ij˻�����Q
                Matrix mtxT2 = new Matrix();//������õĶԳ����Խ���
                double[] bArray2 = new double[mtx16.GetNumColumns()];//���ضԳ����Խ�������Խ���Ԫ��
                double[] cArray2 = new double[mtx16.GetNumColumns()];//ǰn-1��Ԫ�ط��ضԳ����Խ���ĴζԽ���Ԫ��
                double[] resultArray = new double[mtx16.GetNumColumns()];//��Ŧ˵Ľ��ֵ
                // 1: Լ���Գƾ���Ϊ�Գ����Խ���: ��˹�ɶ��±任��
                if (mtx16.MakeSymTri(mtxQ2, mtxT2, bArray2, cArray2))
                {
                    // 2: ����ȫ������ֵ����������
                    //bArray2:����Գ����Խ�������Խ���Ԫ��,����ʱ���ȫ������ֵ��
                    //cArray2:ǰn-1��Ԫ�ش���Գ����Խ���ĴζԽ���Ԫ��
                    //mtxQ2:���ؾ���A������ֵ�����������е�i��Ϊ������dblB�е�i������ֵ��Ӧ������������
                    //60:��������
                    //0.0001:���㾫��
                    if (mtx16.ComputeEvSymTri(bArray2, cArray2, mtxQ2, 60, 0.0001))
                    {
                        int tempi = 0;
                        double tempNum = bArray2[0];
                        for (int i = 0; i < mtxQ2.GetNumColumns(); ++i)
                        {//��������ֵ�������Ǹ�
                            if (tempNum < bArray2[i])
                            {
                                tempi = i;
                                tempNum = bArray2[i];
                            }
                        }
                        for (int i = 0; i < mtxQ2.GetNumRows(); ++i)
                        {
                            if(mtxQ2.GetElement(i,tempi)<0)
                            {//ȡ��ֵ
                                resultArray[i]=-mtxQ2.GetElement(i,tempi);
                            }
                            else
                            {
                                resultArray[i]=mtxQ2.GetElement(i,tempi);
                            }
                        }
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }

                //////////////////////////////////////////

                //��ʮ��
                double[,] x = new double[Rows, Rows];

                ToBeOrdered[] orderNumber2 = new ToBeOrdered[Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Rows; j++)
                    {//�ȸ�ֵ
                        orderNumber2[j].Index = j;
                        orderNumber2[j].Value = Y[j, i];//ע���Ƕ��н��в���
                    }
                    for (int j = 0; j < Rows; j++)
                    {//������
                        for (int k = j + 1; k < Rows; k++)
                        {
                            if (orderNumber2[j].Value < orderNumber2[k].Value)
                            {
                                ToBeOrdered temp = orderNumber2[k];
                                orderNumber2[k] = orderNumber2[j];
                                orderNumber2[j] = temp;
                            }
                        }
                    }
                    for (int j = 0; j < Rows; j++)
                    {//������
                        x[orderNumber2[j].Index, i] = j + 1;//ע��ֵԽ�����ԽС
                    }
                }
                //
                //��ʮһ��
                int[] orderResult = new int[Rows];//��Ŧ˵�����ֵ
                ToBeOrdered[] orderNumber3 = new ToBeOrdered[Rows];

                for (int j = 0; j < Rows; j++)
                {//�ȸ�ֵ
                    orderNumber3[j].Index = j;
                    orderNumber3[j].Value = resultArray[j];
                }
                for (int j = 0; j < Rows; j++)
                {//������
                    for (int k = j + 1; k < Rows; k++)
                    {
                        if (orderNumber3[j].Value < orderNumber3[k].Value)
                        {
                            ToBeOrdered temp = orderNumber3[k];
                            orderNumber3[k] = orderNumber3[j];
                            orderNumber3[j] = temp;
                        }
                    }
                }
                for (int j = 0; j < Rows; j++)
                {//������
                    orderResult[orderNumber3[j].Index] = j + 1;//ע��ֵԽ�����ԽС
                }

                //
                lbState.Text = "������ɣ�";
                pgBar.Value = 100;
                lbState.Visible = false;
                pgBar.Visible = false;

                FrmAssessResultshow result = new FrmAssessResultshow(x,orderResult);
                result.ShowDialog();
            }
            catch
            {
                return false;
            }

                return true;
        }
Exemple #2
0
        public bool CalculateAssessment()
        {
            dgAssessment.Refresh();
            try
            {
                int Rows, Columns;//记录矩阵元素的行数和列数
                Rows    = dgAssessment.Rows.Count - 1;
                Columns = dgAssessment.Columns.Count - 1;

                lbState.Visible = true;
                pgBar.Visible   = true;


                double[,] X = new double[Rows, Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        if (isNumberic(dgAssessment.Rows[i + 1].Cells[j + 1].Value.ToString(), out X[i, j]))
                        {
                            ;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                //第一步
                double[,] S = new double[Rows, Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        //object a=dgChooseSmallIndex.Rows[j].Cells[0].Value;
                        if (dgChooseSmallIndex.Rows[j].Cells[0].Value.ToString().Equals("True"))
                        {
                            S[i, j] = 1 / X[i, j];
                        }
                        else
                        {
                            S[i, j] = X[i, j];
                        }
                    }
                }
                lbState.Text = "正在对原始数据进行规范化";
                pgBar.Value  = 10;
                //第二步
                double[,] R = new double[Rows, Columns];
                double[] M = new double[Columns];
                double[] m = new double[Columns];
                for (int j = 0; j < Columns; j++)
                {
                    M[j] = S[0, j];
                    m[j] = S[0, j];
                    for (int i = 0; i < Rows; i++)
                    {
                        //object a=dgChooseSmallIndex.Rows[j].Cells[0].Value;
                        if (S[i, j] > M[j])
                        {
                            M[j] = S[i, j];
                        }
                        if (S[i, j] < m[j])
                        {
                            m[j] = S[i, j];
                        }
                    }
                }

                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        //object a=dgChooseSmallIndex.Rows[j].Cells[0].Value;
                        R[i, j] = S[i, j] / m[j];
                    }
                }
                lbState.Text = "正在计算综合评价值得取值范围";
                pgBar.Value  = 25;
                //第三步
                double λ1 = dbInputFactorλ1.Value;
                double[,] T = new double[Rows, Columns];
                double[] wu = new double[Columns];
                T = (double [, ])R.Clone();
                for (int j = 0; j < Rows; j++)
                {
                    for (int i = 0; i < Columns; i++)
                    {
                        for (int k = i + 1; k < Columns; k++)
                        {
                            if (T[j, i] < T[j, k])
                            {
                                double temp = T[j, k];
                                T[j, k] = T[j, i];
                                T[j, i] = temp;
                            }
                        }
                    }
                }
                if (radioButton1.Checked)
                { //对于“强权数非独裁性条件”:
                    double temp = 0;
                    for (int i = 0; i < Columns - 2; i++)
                    {
                        wu[i] = Math.Pow(0.5, i + 1);
                        temp += wu[i];
                    }
                    wu[Columns - 2] = wu[Columns - 1] = 0.5 - 0.5 * temp;
                }
                else
                {//对于“弱权数非独裁性条件”:
                    wu[0] = 0.5;
                    wu[1] = 0.5 - (Columns - 2) * Math.Pow(0.5, Columns - 1);
                    for (int i = 2; i < Columns; i++)
                    {
                        wu[i] = Math.Pow(0.5, Columns - 1);
                    }
                }
                double[,] y = new double[Rows, 2];
                for (int i = 0; i < Rows; i++)
                {
                    double temp0 = 0, temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 1, temp5 = 1;
                    for (int j = 0; j < Columns; j++)
                    {
                        temp2 += wu[j] * T[i, Columns - j - 1];
                        temp3 += wu[j] * T[i, j];
                        //temp4 *= Math.Pow();
                        temp4 *= Math.Pow(T[i, Columns - j - 1], 1 / Columns);
                        temp5 *= Math.Pow(T[i, j], 1 / Columns);
                    }
                    temp0 = (λ1 * temp2 + (1 - λ1) * temp4);
                    temp1 = (λ1 * temp3 + (1 - λ1) * temp5);

                    y[i, 0] = temp0;
                    y[i, 1] = temp1;
                }
                lbState.Text = "正在计算各工程方案的竞争视野";
                pgBar.Value  = 45;
                //第四步
                double[,] C_L = new double[Rows, Rows];
                double[,] C_U = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = i; j < Rows; j++)
                    {
                        intersection(y[i, 0], y[i, 1], y[j, 0], y[j, 1], out C_L[i, j], out C_U[i, j]);
                    }
                }

                double[,] d = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = i; j < Rows; j++)
                    {
                        if (i == j)
                        {
                            d[i, j] = 0;//这里不知道横线是什么意思,姑且按照0来计算
                        }
                        else
                        {
                            d[i, j] = d[j, i] = (C_U[i, j] - C_L[i, j]) / (Math.Max(y[i, 1], y[j, 1]) - Math.Min(y[i, 0], y[j, 0]));
                        }
                    }
                }
                lbState.Text = "正在计算各工程方案的竞争强度";
                pgBar.Value  = 70;
                //第五步
                double[,] u = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Rows; j++)
                    {
                        if (i == j)
                        {
                            u[i, j] = 0;
                        }
                        else
                        {
                            double temp = 0;
                            for (int k = 0; k < Rows; k++)
                            {
                                temp += d[i, k];
                            }
                            u[i, j] = d[i, j] / temp;
                        }
                    }
                }
                lbState.Text = "正在计算竞争力关注系数向量";
                pgBar.Value  = 80;
                //第六步
                double λ = dbInputFactorλ.Value;
                double[,] w = new double[Rows, Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        double temp = 0;
                        for (int k = 0; k < Rows; k++)
                        {
                            if (k != i)
                            {
                                temp += R[k, j] * u[i, k];
                            }
                        }
                        w[i, j] = λ * R[i, j] - (1 - λ) * temp;
                    }
                }
                //第七步
                lbState.Text = "正在构造规划问题并求解";
                pgBar.Value  = 90;
                double[,] wx = new double[Rows, Columns];//wx表示w*:x为星的意思
                //对于“强权数非独裁性条件”和“强权数非独裁性条件”代码是一样的:
                //因为:wx是有wu求得的,而wu已经通过上述条件获得。
                ToBeOrdered[] orderNumber = new ToBeOrdered[Columns];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {//先赋值
                        orderNumber[j].Index = j;
                        orderNumber[j].Value = w[i, j];
                    }
                    for (int j = 0; j < Columns; j++)
                    {//再排序
                        for (int k = j + 1; k < Columns; k++)
                        {
                            if (orderNumber[j].Value < orderNumber[k].Value)
                            {
                                ToBeOrdered temp = orderNumber[k];
                                orderNumber[k] = orderNumber[j];
                                orderNumber[j] = temp;
                            }
                        }
                    }
                    for (int j = 0; j < Columns; j++)
                    {//最后输出
                        wx[i, orderNumber[j].Index] = wu[j];
                    }
                }
                //第八步
                double[,] Y = new double[Rows, Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Rows; j++)
                    {
                        double temp = 0, temp6 = 0, temp7 = 1;
                        for (int k = 0; k < Columns; k++)
                        {
                            //temp += wx[j, k] * R[i, k];

                            temp6 += wx[j, k] * R[i, k];
                            temp7 *= Math.Pow(R[i, k], 1 / Columns);
                        }
                        //Y[i, j] = temp;
                        temp    = (λ1 * temp6 + (1 - λ1) * temp7);
                        Y[i, j] = temp;
                    }
                }
                //第九步
                //计算矩阵的正特征向量
                double[,] Y1 = new double[Rows, Rows]; //左侧
                double[,] Y2 = new double[Rows, Rows]; //右侧
                double[,] Y3 = new double[Rows, Rows]; //结果
                Y1           = (double [, ])Y.Clone();
                for (int i = 0; i < Rows; i++)
                {//构造转置矩阵
                    for (int j = 0; j < Rows; j++)
                    {
                        Y2[i, j] = Y1[j, i];
                    }
                }
                for (int i = 0; i < Rows; i++)
                {//构造对称矩阵
                    for (int j = 0; j < Rows; j++)
                    {
                        double temp = 0;
                        for (int k = 0; k < Rows; k++)
                        {
                            temp += Y1[i, k] * Y2[k, j];
                        }
                        Y3[i, j] = temp;
                    }
                }
                double[] Y4 = new double[Rows * Rows]; //用于计算参数
                for (int i = 0; i < Rows; i++)
                {                                      //将对称矩阵转换为一维数组
                    for (int j = 0; j < Rows; j++)
                    {
                        Y4[i * Rows + j] = Y3[i, j];
                    }
                }
                //////////////////////////////////////////
                // 实对称三对角阵的全部特征值与特征向量的计算
                Matrix mtx16 = new Matrix(Rows, Rows, Y4);

                Matrix   mtxQ2       = new Matrix();                      //返回豪斯荷尔德变换的乘积矩阵Q
                Matrix   mtxT2       = new Matrix();                      //返回求得的对称三对角阵
                double[] bArray2     = new double[mtx16.GetNumColumns()]; //返回对称三对角阵的主对角线元素
                double[] cArray2     = new double[mtx16.GetNumColumns()]; //前n-1个元素返回对称三对角阵的次对角线元素
                double[] resultArray = new double[mtx16.GetNumColumns()]; //存放λ的结果值
                // 1: 约化对称矩阵为对称三对角阵: 豪斯荷尔德变换法
                if (mtx16.MakeSymTri(mtxQ2, mtxT2, bArray2, cArray2))
                {
                    // 2: 计算全部特征值与特征向量
                    //bArray2:传入对称三对角阵的主对角线元素,返回时存放全部特征值。
                    //cArray2:前n-1个元素传入对称三对角阵的次对角线元素
                    //mtxQ2:返回矩阵A的特征值向量矩阵。其中第i列为与数组dblB中第i个特征值对应的特征向量。
                    //60:迭代次数
                    //0.0001:计算精度
                    if (mtx16.ComputeEvSymTri(bArray2, cArray2, mtxQ2, 60, 0.0001))
                    {
                        int    tempi   = 0;
                        double tempNum = bArray2[0];
                        for (int i = 0; i < mtxQ2.GetNumColumns(); ++i)
                        {//查找特征值中最大的那个
                            if (tempNum < bArray2[i])
                            {
                                tempi   = i;
                                tempNum = bArray2[i];
                            }
                        }
                        for (int i = 0; i < mtxQ2.GetNumRows(); ++i)
                        {
                            if (mtxQ2.GetElement(i, tempi) < 0)
                            {//取正值
                                resultArray[i] = -mtxQ2.GetElement(i, tempi);
                            }
                            else
                            {
                                resultArray[i] = mtxQ2.GetElement(i, tempi);
                            }
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }

                //////////////////////////////////////////

                //第十步
                double[,] x = new double[Rows, Rows];

                ToBeOrdered[] orderNumber2 = new ToBeOrdered[Rows];
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Rows; j++)
                    {                                    //先赋值
                        orderNumber2[j].Index = j;
                        orderNumber2[j].Value = Y[j, i]; //注意是对列进行操作
                    }
                    for (int j = 0; j < Rows; j++)
                    {//再排序
                        for (int k = j + 1; k < Rows; k++)
                        {
                            if (orderNumber2[j].Value < orderNumber2[k].Value)
                            {
                                ToBeOrdered temp = orderNumber2[k];
                                orderNumber2[k] = orderNumber2[j];
                                orderNumber2[j] = temp;
                            }
                        }
                    }
                    for (int j = 0; j < Rows; j++)
                    {                                        //最后输出
                        x[orderNumber2[j].Index, i] = j + 1; //注意值越大,序号越小
                    }
                }
                //
                //第十一步
                int[]         orderResult  = new int[Rows];//存放λ的排序值
                ToBeOrdered[] orderNumber3 = new ToBeOrdered[Rows];

                for (int j = 0; j < Rows; j++)
                {//先赋值
                    orderNumber3[j].Index = j;
                    orderNumber3[j].Value = resultArray[j];
                }
                for (int j = 0; j < Rows; j++)
                {//再排序
                    for (int k = j + 1; k < Rows; k++)
                    {
                        if (orderNumber3[j].Value < orderNumber3[k].Value)
                        {
                            ToBeOrdered temp = orderNumber3[k];
                            orderNumber3[k] = orderNumber3[j];
                            orderNumber3[j] = temp;
                        }
                    }
                }
                for (int j = 0; j < Rows; j++)
                {                                               //最后输出
                    orderResult[orderNumber3[j].Index] = j + 1; //注意值越大,序号越小
                }

                //
                lbState.Text    = "计算完成!";
                pgBar.Value     = 100;
                lbState.Visible = false;
                pgBar.Visible   = false;

                FrmAssessResultshow result = new FrmAssessResultshow(x, orderResult);
                result.ShowDialog();
            }
            catch
            {
                return(false);
            }

            return(true);
        }