/// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public override object Clone()
        {
            var e = new MultivariateEmpiricalDistribution(Dimension);

            e.chol            = (CholeskyDecomposition)chol.Clone();
            e.determinant     = determinant;
            e.kernel          = kernel;
            e.numberOfSamples = numberOfSamples;
            e.repeats         = (int[])repeats.Clone();
            e.samples         = (double[][])samples.MemberwiseClone();
            e.smoothing       = smoothing.MemberwiseClone();
            e.sumOfWeights    = sumOfWeights;
            e.type            = type;

            if (e.weights != null)
            {
                e.weights = (double[])weights.Clone();
            }

            if (e.repeats != null)
            {
                e.repeats = (int[])repeats.Clone();
            }

            return(e);
        }
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public override object Clone()
        {
            var clone = new MultivariateNormalDistribution(this.Dimension, false);

            clone.lnconstant = lnconstant;
            clone.covariance = (double[, ])covariance.Clone();
            clone.mean       = (double[])mean.Clone();
            clone.chol       = (CholeskyDecomposition)chol.Clone();

            return(clone);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        public override object Clone()
        {
            var clone = new NormalDistribution(Dimension);

            clone.constant   = constant;
            clone.covariance = (double[, ])covariance.Clone();
            clone.mean       = (double[])mean.Clone();
            clone.variance   = (double[])variance.Clone();

            clone.chol = (CholeskyDecomposition)chol.Clone();
            clone.svd  = (svd != null) ? (SingularValueDecomposition)svd.Clone() : null;

            return(clone);
        }
        /// <summary>
        ///   Creates a new object that is a copy of the current instance.
        /// </summary>
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public override object Clone()
        {
            var clone = new MultivariateNormalDistribution(this.Dimension, false);

            clone.lnconstant = lnconstant;
            clone.covariance = (double[, ])covariance.Clone();
            clone.mean       = (double[])mean.Clone();

            if (chol != null)
            {
                clone.chol = (CholeskyDecomposition)chol.Clone();
            }

            if (svd != null)
            {
                clone.svd = (SingularValueDecomposition)svd.Clone();
            }

            return(clone);
        }