コード例 #1
0
        internal override BaseDistribution InnerGetProduct(BaseDistribution value)
        {
            switch (value.InnerDistributionType)
            {
            case DistributionType.Number:
            {
                return(Mean * value.InnerMean);
            }

            case DistributionType.Continious:
            {
                return(ContinuousRandomMath.Multiply((ContinuousDistribution)value, Mean));
            }

            case DistributionType.Discrete:
            {
                return(DiscreteRandomMath.Multiply((DiscreteDistribution)value, Mean));
            }

            default:
            {
                throw new DistributionsInvalidOperationException();
            }
            }
        }
コード例 #2
0
        internal override BaseDistribution InnerGetProduct(BaseDistribution value)
        {
            switch (value.InnerDistributionType)
            {
            case DistributionType.Continious:
            case DistributionType.Discrete:
            {
                return(Discretize() * value);
            }

            case DistributionType.Number:
            {
                if (value.InnerMean == 0)
                {
                    throw new DistributionsInvalidOperationException(DistributionsInvalidOperationExceptionType.MultiplyRandomByZero);
                }

                return(ContinuousRandomMath.Multiply(this, (double)value));
            }

            default:
                throw new DistributionsInvalidOperationException();
            }
        }