Пример #1
0
        public static ISampler <T> GaussianSampler <T>(this MklRng rng, GaussianSpec <T> spec)
            where T : unmanaged
        {
            var sampler = default(ISampler <T>);

            if (typeof(T) == typeof(float))
            {
                sampler = samplers.gaussian(rng, spec.ToFloat32()) as ISampler <T>;
            }
            else if (typeof(T) == typeof(double))
            {
                sampler = samplers.gaussian(rng, spec.ToFloat64()) as ISampler <T>;
            }
            else
            {
                throw unsupported <T>();
            }
            return(sampler);
        }