Exemple #1
0
        [Stochastic] // must be labelled Stochastic to get correct schedule, even though it isn't Stochastic
        public static GibbsMarginal <TDist, T> MarginalGibbs <TDist, T>(
            T Use, [IgnoreDependency] TDist Def,
            GibbsMarginal <TDist, T> to_marginal)
            where TDist : IDistribution <T>, Sampleable <T>
        {
            GibbsMarginal <TDist, T> result = to_marginal;
            TDist marginal = result.LastConditional;

            marginal.Point         = Use;
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }
Exemple #2
0
        [Stochastic] // must be labelled Stochastic to get correct schedule, even though it isn't Stochastic
        public static GibbsMarginal <TDist, TDomain> MarginalGibbs <TDist, TDomain>(
            TDomain Def,
            GibbsMarginal <TDist, TDomain> to_marginal)
            where TDist : IDistribution <TDomain>, Sampleable <TDomain>
        {
            GibbsMarginal <TDist, TDomain> result = to_marginal;
            TDist marginal = result.LastConditional;

            marginal.Point         = Def;
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }
Exemple #3
0
        public static GibbsMarginal <TDist, T> MarginalGibbs <TDist>(
            IList <TDist> Uses,
            T Def,
            GibbsMarginal <TDist, T> to_marginal) // must not be called 'result', because its value is used
            where TDist : IDistribution <T>, SettableToProduct <TDist>, SettableToRatio <TDist>, SettableTo <TDist>, Sampleable <T>
        {
            GibbsMarginal <TDist, T> result = to_marginal;
            TDist marginal = result.LastConditional;

            marginal.Point         = Def;
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }
Exemple #4
0
        public static GibbsMarginal <TDist, T> MarginalGibbs <TDist, T>(
            TDist Use,
            [SkipIfUniform] TDist Def,
            GibbsMarginal <TDist, T> to_marginal)
            where TDist : IDistribution <T>, SettableToProduct <TDist>, Sampleable <T>
        {
            GibbsMarginal <TDist, T> result = to_marginal;
            TDist marginal = result.LastConditional;

            marginal.SetToProduct(Def, Use);
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }
Exemple #5
0
        public static GibbsMarginal <TDist, T> MarginalGibbs <TDist, T>(
            T Use,
            [SkipIfUniform] TDist Def,
            GibbsMarginal <TDist, T> to_marginal) // must not be called 'result', because its value is used
            where TDist : IDistribution <T>, Sampleable <T>
        {
            GibbsMarginal <TDist, T> result = to_marginal;
            TDist marginal = result.LastConditional;

            marginal.Point         = Use;
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }
Exemple #6
0
        [Stochastic] // must be labelled Stochastic to get correct schedule, even though it isn't Stochastic
        public static GibbsMarginal <TDist, T> MarginalGibbs <TDist>(
            T[] Uses,
            GibbsMarginal <TDist, T> to_marginal)
            where TDist : IDistribution <T>, Sampleable <T>
        {
            GibbsMarginal <TDist, T> result = to_marginal;
            TDist marginal = result.LastConditional;

            if (Uses.Length != 1)
            {
                throw new ArgumentException("Uses.Length (" + Uses.Length + ") != 1");
            }
            marginal.Point         = Uses[0];
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }
Exemple #7
0
        public static GibbsMarginal <TDist, T> MarginalGibbs <TDist>(
            IList <T> Uses,
            [SkipIfUniform] TDist Def,
            GibbsMarginal <TDist, T> to_marginal)            // must not be called 'result', because its value is used
            where TDist : IDistribution <T>, SettableToProduct <TDist>, SettableToRatio <TDist>, SettableTo <TDist>, Sampleable <T>
        {
            if (Uses.Count > 1)
            {
                throw new ArgumentException("Uses.Count > 1");
            }
            GibbsMarginal <TDist, T> result = to_marginal;
            TDist marginal = result.LastConditional;

            marginal.Point         = Uses[0];
            result.LastConditional = marginal;
            // Allow a sample to be drawn from the last conditional, and add it to the sample
            // list and conditional list
            result.PostUpdate();
            return(result);
        }