commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kinow <...@git.apache.org>
Subject [GitHub] commons-rng pull request #5: Feature rng 37
Date Tue, 10 Oct 2017 21:37:34 GMT
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-rng/pull/5#discussion_r143859435
  
    --- Diff: commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratGaussianSampler.java
---
    @@ -0,0 +1,159 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.commons.rng.sampling.distribution;
    +
    +import org.apache.commons.rng.UniformRandomProvider;
    +
    +/**
    + * Gaussian Sampling by
    + * <a href="https://en.wikipedia.org/wiki/Ziggurat_algorithm">Ziggurat algorithm</a>
    + *
    + * <p>Based on
    + * "The Ziggurat Method for Generating Random Variables"<br>
    + * by George Marsaglia and Wai Wan Tsang</p>
    + *
    + * @see <a href="http://www.jstatsoft.org/article/view/v005i08/ziggurat.pdf">Ziggurat
Method for Generating Random Variables</a>
    + *
    + * @since 1.1
    + */
    +
    +public class ZigguratGaussianSampler
    +    extends SamplerBase
    +    implements NormalizedGaussianSampler {
    +
    +    /**
    +     * Generates values from Gaussian (normal) probability distribution
    +     * It uses two tables, integers KN and reals WN. Some 99% of the time,
    +     * the required x is produced by:
    +     * generate a random 32-bit integer j and let i be the index formed from
    +     * the rightmost 8 bits of j. If j < k_i return x = j * w_i.
    +     */
    +
    +    /* @param KN - an auxiliary table of integers, k_i = 2^32*(x_{i-1}/x_i) */
    +    private static final int[] KN = new int[128];
    +    /* @param WN - table of doubles, w_i = x_i/2^32 */
    +    private static final double[] WN = new double[128];
    +    /* @param FN - the function values table (normalized gaussian in this implementation)
    +     * f_i(x_i) = exp(-x_i^2/2)
    +     */
    --- End diff --
    
    This is almost fixed. What you added were multiline comments, ignored by javadoc. You
have to use
    
    ```
    /**
     * This is a Javadoc. Here goes your text...
     */
    ```
    
    Instead of
    
    ```
    
    /**
     * This is a multi-line comment. Here goes your text...
     */
    ```
    
    Site reports still have issues with these comments above.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message