コード例 #1
0
        public override void Validate()
        {
            base.Validate();
            if (HasErrors())
            {
                return;
            }
            if (Model.Rho == null ||
                Model.Per == null)
            {
                AddError("Some of the QP-model parameters are not set");
                return;
            }
            if (Model.N != Model.Rho.Length ||
                Model.N != Model.Per.Length)
            {
                AddError("Inconsistent matrices and arrays dimensions");
                return;
            }

            if (!MatrixUtils.IsStochasticByRows(Model.Rho))
            {
                AddError("Rho vectors should be stochastic");
            }

            if (!DoubleUtils.AreEqual(Model.Pi.Sum(), 1))
            {
                AddError("Sum of Pi elements should be equal to 1");
            }

            if (!IsRhoAdapted())
            {
                AddError("Rho is not adapted");
            }

            if (!IsFAdapted())
            {
                AddError("Matrix F is not adapted");
            }
        }