Example #1
0
 void IPostSetArrow.PostSetArrow()
 {
     Set(trans, meas, realMeasurements, covState, covMea);
     Set(init, diff, meaDiff);
     if (delta == null)
     {
         int[][] n = new int[][] {
             FiniteMatrixDerivationTransformer.IsAccessible(transitionObjectM.Transformer),
             FiniteMatrixDerivationTransformer.IsAccessible(measurementsM.Transformer)
         };
         CreateAdd(n);
     }
     isSerialized = false;
 }
Example #2
0
        /// <summary>
        /// Set parameters
        /// </summary>
        /// <param name="trans">Transition</param>
        /// <param name="meas">Measurements</param>
        /// <param name="realMeasurements">Real measurements</param>
        /// <param name="covState">Covariation of state vector</param>
        /// <param name="covMea">Measurements of covariation matrix</param>
        /// <returns>True in success and false otherwise</returns>
        public bool Set(string trans, string meas, string realMeasurements, string covState, string covMea)
        {
            string[]             str = new string[] { trans, meas };
            IObjectTransformer[] tr  = new IObjectTransformer[2];
            int[][] n = new int[2][];
            Diagram.UI.Interfaces.IComponentCollection cc = this;
            for (int i = 0; i < str.Length; i++)
            {
                IObjectTransformer trt = cc.GetCollectionObject <IObjectTransformer>(str[i]);
                int[] k = FiniteMatrixDerivationTransformer.IsAccessible(
                    cc.GetCollectionObject <IObjectTransformer>(str[i]));
                if (k == null)
                {
                    return(false);
                }
                n[i]  = k;
                tr[i] = trt;
            }
            if ((n[0][0] != n[0][1]) | (n[0][1] != n[1][0]))
            {
                return(false);
            }
            IMeasurements[] mm = new IMeasurements[]
            {
                cc.GetCollectionObject <IMeasurements>(realMeasurements),
                cc.GetCollectionObject <IMeasurements>(covState),
                cc.GetCollectionObject <IMeasurements>(covMea)
            };
            ArrayReturnType[] art = new ArrayReturnType[3];
            Double            a   = 0;

            int[] d = new int[] { 1, 2, 2 };
            for (int i = 0; i < art.Length; i++)
            {
                IMeasurements mea = mm[i];
                if (mea == null)
                {
                    return(false);
                }

                if (mea.Count != 1)
                {
                    return(false);
                }
                object r = mea[0].Type;
                if (!(r is ArrayReturnType))
                {
                    return(false);
                }
                ArrayReturnType att = r as ArrayReturnType;
                art[i] = att;
                if (!att.ElementType.Equals(a))
                {
                    return(false);
                }
                if (att.Dimension.Length != d[i])
                {
                    return(false);
                }
            }
            ArrayReturnType at = art[0];

            if (at.Dimension[0] != n[1][1])
            {
                return(false);
            }
            at = art[1];
            if ((at.Dimension[0] != n[0][0]) | (at.Dimension[1] != n[0][0]))
            {
                return(false);
            }
            at = art[2];
            if ((at.Dimension[0] != n[1][1]) | (at.Dimension[1] != n[1][1]))
            {
                return(false);
            }
            inmea                 = mm;
            this.trans            = trans;
            this.meas             = meas;
            this.realMeasurements = realMeasurements;
            this.covState         = covState;
            this.covMea           = covMea;
            transitionObjectM     = new FiniteMatrixDerivationTransformer(tr[0]);
            measurementsM         = new FiniteMatrixDerivationTransformer(tr[1]);
            CreateMeas(n[1]);
            state       = Create(n[0][0]);
            covariation = Create(n[0]);
            if (!isSerialized)
            {
                CreateArrays(n);
            }
            return(true);
        }