예제 #1
0
        /// <summary>
        /// 合并,产生新的。
        /// </summary>
        /// <param name="linesA"></param>
        /// <param name="linesB"></param>
        /// <returns></returns>
        public static List <MatrixLine> Merge(List <MatrixLine> linesA, List <MatrixLine> linesB)
        {
            double[][]        matrixA = SinexMatrixConvertor.GetMatrixArrayJagged(linesA);
            double[][]        matrixB = SinexMatrixConvertor.GetMatrixArrayJagged(linesB);
            double[][]        matrixC = MatrixUtil.BuildMatrix(matrixA, matrixB);
            List <MatrixLine> lines   = SinexMatrixConvertor.GetMatrixLines(matrixC);

            return(lines);
        }
예제 #2
0
        /// <summary>
        /// 合并,产生新的。
        /// 乘以协方差系数。 varFactor = NowFactor / OldFactor
        /// </summary>
        /// <param name="list1"></param>
        /// <param name="varFactorA"></param>
        /// <param name="list2"></param>
        /// <param name="varFactorB"></param>
        /// <returns></returns>
        public static List <MatrixLine> Merge(List <MatrixLine> linesA, double varFactorA, List <MatrixLine> linesB, double varFactorB)
        {
            double[][] matrixA = SinexMatrixConvertor.GetMatrixArrayJagged(linesA);
            double[][] matrixB = SinexMatrixConvertor.GetMatrixArrayJagged(linesB);
            //乘以协方差系数。
            MatrixUtil.Multiply(matrixA, varFactorA);
            MatrixUtil.Multiply(matrixB, varFactorB);

            double[][]        matrixC = MatrixUtil.BuildMatrix(matrixA, matrixB);
            List <MatrixLine> lines   = SinexMatrixConvertor.GetMatrixLines(matrixC);

            return(lines);
        }
예제 #3
0
        /// <summary>
        /// 清除非坐标的信息。同时清理对应的矩阵。
        /// </summary>
        /// <param name="solutionValues"></param>
        /// <param name="matrixBlock"></param>
        public static void CleanNonCoordSolutionValue(ICollectionBlock <SolutionValue> solutionValues, SolutionMatrixBlock matrixBlock)
        {
            if (solutionValues == null || solutionValues.Items == null || solutionValues.Items.Count == 0)
            {
                return;
            }

            List <int> tobeRemoveIndexes = new List <int>();
            int        index             = 0;

            foreach (var item in solutionValues.Items)
            {
                if (item.ParameterType != ParameterType.STAX &&
                    item.ParameterType != ParameterType.STAY &&
                    item.ParameterType != ParameterType.STAZ)
                {
                    tobeRemoveIndexes.Add(index);
                }
                index++;
            }

            for (int i = tobeRemoveIndexes.Count - 1; i >= 0; i--)
            {
                solutionValues.Items.RemoveAt(tobeRemoveIndexes[i]);
            }

            //清理对应的矩阵
            if (matrixBlock == null || matrixBlock.Items.Count == 0)
            {
                return;
            }
            double[][] matrix        = SinexMatrixConvertor.GetMatrix(matrixBlock.Items);
            double[][] cleanedMatrix = MatrixUtil.ShrinkMatrix(matrix, tobeRemoveIndexes);

            //更新
            matrixBlock.Items = SinexMatrixConvertor.GetMatrixLines(cleanedMatrix);
        }
예제 #4
0
 public static SolutionMatrixBlock CreateSolutionMatrixAprioriCova(double[][] matrix)
 {
     return(CreateSolutionMatrixAprioriCova(SinexMatrixConvertor.GetMatrixLines(matrix)));
 }