예제 #1
0
        /// <summary>
        /// 计算,返回观测量的该证数。
        /// </summary>
        /// <returns></returns>
        public void Process()
        {
            //观测值和系数阵
            IMatrix B  = CoeffOfCondition;       //系数阵
            IMatrix BT = B.Transposition;
            IMatrix B0 = ConstVectorOfCondition; //条件常数项
            IMatrix L  = Observation;            //观测值

            //权阵和权逆阵
            var QL = this.Observation.InverseWeight;
            var PL = QL.GetInverse();

            var W = B.Multiply(L).Plus(B0);              //W = BL + B0
            //解算
            var BQBT      = B.Multiply(QL).Multiply(BT); //Normal
            var InverBQBT = BQBT.GetInverse();
            //求V和Q的中间量 - Q*BT*InverN
            var Temp = QL.Multiply(BT).Multiply(InverBQBT).Multiply(-1);
            //结果 DL = V,即观测值的改正数
            IMatrix V  = Temp.Multiply(W);
            var     Qv = Temp.Multiply(B).Multiply(QL);//Temp * B * QL

            //结果转化
            this.Correction = new WeightedVector(V.GetCol(0), Qv)
            {
                ParamNames = this.Observation.ParamNames
            };

            var VT   = V.Transposition;
            var VTPV = VT.Multiply(PL).Multiply(V);

            this.VarianceOfUnitWeight = VTPV[0, 0] / CoeffOfCondition.RowCount;
            var QLhat = QL.Minus(Qv);

            this.CorrectedObservation = new WeightedVector(Observation.Plus(V), QLhat)
            {
                ParamNames = Observation.ParamNames
            };
        }