コード例 #1
0
        //求Q
        internal static double[,] GetQ(double[,] A, double[,] X, double[,] L, int PointCount)
        {
            /*
             * 平差课本
             * (P130,7-3-2) 单位权中误差σ0 = √((V^(T)*PV)/r)
             * P = I
             * (P112,7-1-4)V = AX - L
             * r = n - t
             * (P132,表7-9) Qxx = NBB^(-1) = (A^(T)*PA)^(-1)
             * (P133,7-3-15) σx = σ0 * √Qxx
             */

            double m0 = Math.Sqrt((MatrixComputation.Multiply(MatrixComputation.Transpose(MatrixComputation.Subtract(MatrixComputation.Multiply(A, X), L)), MatrixComputation.Subtract(MatrixComputation.Multiply(A, X), L))[0, 0] / (2 * PointCount - 6)));

            double[,] Q = MatrixComputation.Inverse(MatrixComputation.Multiply(MatrixComputation.Transpose(A), A));
            for (int i = 0; i < Q.GetLength(0); i++)
            {
                for (int j = 0; j < Q.GetLength(1); j++)
                {
                    Q[i, j] = Math.Sqrt(Q[i, j]) * m0;
                }
            }
            return(Q);
        }
コード例 #2
0
ファイル: Matrix.cs プロジェクト: Terieqin2/Calculator
 /// <summary>
 /// 全选主元高斯-约当法求逆矩阵
 /// </summary>
 /// <returns>逆矩阵</returns>
 public Matrix Inverse()
 {
     return(MatrixComputation.Inverse(elements));
 }
コード例 #3
0
 //求改正数
 internal static double[,] GetX(double[,] A, double[,] L)
 {
     //X = (A^(T)A)^(-1)*A^(T)*L
     return(MatrixComputation.Multiply(MatrixComputation.Multiply(MatrixComputation.Inverse((MatrixComputation.Multiply(MatrixComputation.Transpose(A), A))), MatrixComputation.Transpose(A)), L));
 }