Exemple #1
0
        /// <summary>
        /// 根据两个Sinex文件,提取系数阵。就是参数平差的参数系数阵。
        /// Get coe Of Params Matrix Of Params
        /// </summary>
        /// <param name="fileA"></param>
        /// <param name="fileB"></param>
        /// <returns></returns>
        public static double[][] GetCoeffMatrixOfParams(SinexFile fileA, SinexFile fileB)
        {
            List <string> paramCodes          = SinexFile.GetDistinctSiteCodes(fileA, fileB);
            List <string> codesA              = fileA.GetSiteCods();
            List <string> codesB              = fileB.GetSiteCods();
            List <int>    sameParamIndexesInB = new List <int>();//B文件中具有相同测站的代码的索引号。

            for (int i = 0; i < codesB.Count; i++)
            {
                if (codesA.Contains(codesB[i]))
                {
                    sameParamIndexesInB.Add(i);
                }
            }

            int paramCountA = fileA.EstimateParamCount;               //文件A的参数,一个测站有三个参数X,Y,Z
            int row         = paramCountA + fileB.EstimateParamCount; //观测数量包含A和B
            int col         = paramCodes.Count * 3;                   //新参数数量(除去了A,B共有参数)

            double[][] array = MatrixUtil.Create(row, col);

            int indentCount = 0;//有多少参数相同,则缩进多少位置

            for (int i = 0; i < paramCountA; i++)
            {
                array[i][i] = 1;                          //先A
            }
            for (int i = paramCountA; i < row; i++)       //再B
            {
                int siteIndexInB = (i - paramCountA) / 3; //测站名在B中的索引
                if (sameParamIndexesInB.Contains(siteIndexInB))
                {
                    int colInA = codesA.IndexOf(codesB[siteIndexInB]) * 3;//在A中的索引
                    array[i][colInA]       = 1;
                    array[++i][colInA + 1] = 1;
                    array[++i][colInA + 2] = 1;

                    indentCount += 3;//一个测站缩进三单位
                }
                else
                {
                    array[i][i - indentCount] = 1;
                }
            }

            return(array);
        }
Exemple #2
0
        /// <summary>
        /// 未知参数的先验值。是一个列向量.
        /// </summary>
        /// <param name="fileA"></param>
        /// <param name="fileB"></param>
        /// <returns></returns>
        public static double[][] GetApriori(SinexFile fileA, SinexFile fileB)
        {
            int row = SinexFile.GetDistinctSiteCodes(fileA, fileB).Count * 3;

            double[][] array = MatrixUtil.Create(row, 1);

            int j = 0;

            foreach (var item in fileA.SolutionAprioriBlock.Items)
            {
                array[j++][0] = item.ParameterValue;
            }

            List <string> sames = SinexFile.GetSameSiteCodes(fileA, fileB);

            foreach (var item in fileB.SolutionAprioriBlock.Items)
            {
                if (!sames.Contains(item.SiteCode))
                {
                    array[j++][0] = item.ParameterValue;
                }
            }
            return(array);
        }