package cs437.som.membership;

import cs437.som.NeighborhoodMembershipFunction;

public class GeometricNeighborhoodMembershipFunction implements NeighborhoodMembershipFunction {
    double order;

    public GeometricNeighborhoodMembershipFunction(double order) {
        this.order = order;
    }

    public double neighborhoodMembership(double distance, double width) {
        if (distance < width)
            return Math.pow((width - distance) / width, order);
        else
            return 0;
    }
}

@@ -78,123 +78,807 @@
 n;%0A%0A
-public class GeometricNeighborhoodMembershipFunction implements NeighborhoodMembershipFunction %7B%0A    double order;%0A
+/**%0A * Geometric neighborhood membership function.%0A *%0A * The membership of a neuron under this strategy follows the equation:%0A * %3Cpre%3E%0A *     %5Cbegin%7Bcases%7D%0A *     %5Cleft(%5Cfrac%7Bw - D(N, N_%7Bbm%7D)%7D%7Bw%7D%5Cright)%5Ek & %5Ctext%7Bif%7D D(N, N_%7Bbm%7D) %3C w%5C%5C%0A *     0 & %5Ctext%7Botherwise%7D%0A *     %5Cend%7Bcases%7D%0A * where%0A *     w      is the neighborhood width%0A *     N      is the neuron in question%0A *     N_%7Bbm%7D is the BMU%0A *     k      is the order of the membership function%0A *     D(x,y) is the provided distance from the neuron to the BMU%0A * %3C/pre%3E%0A */%0Apublic class GeometricNeighborhoodMembershipFunction implements NeighborhoodMembershipFunction %7B%0A    private final double order;%0A%0A    /**%0A     * Create a GeometricNeighborhoodMembershipFunction.%0A     *%0A     * @param order The exponential order of the function.%0A     */
 %0A   
@@ -976,16 +976,30 @@
 %0A    %7D%0A%0A
+    @Override%0A
     publ
@@ -1198,11 +1198,130 @@
 0;%0A    %7D
+%0A%0A    @Override%0A    public String toString() %7B%0A        return %22GeometricNeighborhoodMembershipFunction %22 + order;%0A    %7D
 %0A%7D%0A

Document GeometricNeighborhoodMembershipFunction.