From a716d28cc35f5d8b090af88ceba8c901b7eb3297 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Fri, 28 Nov 2014 16:13:01 -0500 Subject: [PATCH] Fixed javadocs so they compile and made pom compatable for official repositories. Change-Id: I05d54c1ba12df671e924cd469e4ecc9e8d17499c --- pom.xml | 120 +++++---- .../classify/naive/bayes/package-info.java | 3 +- .../genetics/wavelets/ExpressionFunction.java | 10 +- .../wavelets/SignalProcessingWavelet.java | 12 +- .../dann/graph/AbstractAdjacencyGraph.java | 8 + .../HyperassociativeMapCanvas.java | 3 + .../graph/topological/KnotOptimizedGraph.java | 1 + .../topological/StructureOptimizedGraph.java | 1 + .../dann/graph/topological/Topography.java | 58 ++++- .../dann/math/OrderedFieldElement.java | 4 + .../java/com/syncleus/dann/math/Vector.java | 3 + .../math/counting/PermutationCounter.java | 5 + .../com/syncleus/dann/math/linear/Matrix.java | 1 + .../dann/math/linear/SimpleRealMatrix.java | 9 +- ...eskyBanachiewiczCholeskyDecomposition.java | 4 +- .../CholeskyCroutCholeskyDecomposition.java | 4 +- .../decomposition/CholeskyDecomposition.java | 4 +- .../DoolittleLuDecomposition.java | 8 +- .../HouseholderQrDecomposition.java | 6 +- .../linear/decomposition/LuDecomposition.java | 8 +- .../linear/decomposition/QrDecomposition.java | 6 +- .../SingularValueDecomposition.java | 14 +- .../StewartSingularValueDecomposition.java | 18 +- .../TridiagonalEignevalueDecomposition.java | 4 +- .../visualization/MathFunctionCanvas.java | 167 ------------ .../visualization/MathFunctionDataBinder.java | 239 ------------------ .../dann/neural/AbstractActivationNeuron.java | 2 + .../dann/neural/AbstractLocalBrain.java | 8 +- .../syncleus/dann/neural/AbstractNeuron.java | 1 + .../syncleus/dann/neural/AbstractSynapse.java | 4 + .../com/syncleus/dann/neural/NeuronGroup.java | 5 +- .../syncleus/dann/neural/SimpleSynapse.java | 4 + .../backprop/AbstractBackpropNeuron.java | 4 + .../AbstractOutputBackpropNeuron.java | 4 + .../neural/backprop/SimpleBackpropNeuron.java | 5 + .../backprop/SimpleOutputBackpropNeuron.java | 4 + .../brain/FullyConnectedFeedforwardBrain.java | 8 + .../dann/neural/som/SimpleSomNeuron.java | 1 + .../syncleus/dann/xml/XmlSerializable.java | 8 + 39 files changed, 257 insertions(+), 521 deletions(-) delete mode 100644 src/main/java/com/syncleus/dann/math/visualization/MathFunctionCanvas.java delete mode 100644 src/main/java/com/syncleus/dann/math/visualization/MathFunctionDataBinder.java diff --git a/pom.xml b/pom.xml index 7a8fb827..5517fda4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ <modelVersion>4.0.0</modelVersion> <parent> - <groupId>com.syncleus</groupId> + <groupId>com.syncleus.dann</groupId> <artifactId>dann</artifactId> <version>2.1-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <packaging>jar</packaging> - <groupId>com.syncleus</groupId> + <groupId>com.syncleus.dann</groupId> <artifactId>dann-core</artifactId> <version>2.1-SNAPSHOT</version> @@ -58,17 +58,19 @@ </mailingList> </mailingLists> + <repositories> + <repository> + <id>ossrh.snapshots</id> + <url>https://oss.sonatype.org/content/repositories/snapshots</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> - <distributionManagement> - <repository> - <id>syncleus.releases</id> - <url>http://repo.syncleus.com/repository/releases/</url> - </repository> - <snapshotRepository> - <id>syncleus.snapshots</id> - <url>http://repo.syncleus.com/repository/snapshots/</url> - </snapshotRepository> - </distributionManagement> <build> @@ -92,6 +94,39 @@ <encoding>${project.build.resourceEncoding}</encoding> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>2.2.1</version> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.9.1</version> + <configuration> + <sourcepath>src/main/java/</sourcepath> + </configuration> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-gpg-plugin</artifactId> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> @@ -268,64 +303,25 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.8.1</version> + <version>4.11</version> <scope>test</scope> </dependency> - - <dependency> - <groupId>org.freehep</groupId> - <artifactId>freehep-java3d</artifactId> - <version>2.0</version> - </dependency> - <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics</artifactId> - <version>0.6.0</version> - </dependency> - - <dependency> - <groupId>java3d</groupId> - <artifactId>vecmath</artifactId> - <version>1.3.1</version> + <version>0.9.1</version> </dependency> - - - </dependencies> - - <repositories> - <repository> - <id>freehep-maven</id> - <name>Maven FreeHEP</name> - <url>http://java.freehep.org/maven2</url> - </repository> - - <repository> - <id>snapshots</id> - <name>Syncleus Maven Snapshot Repository</name> - <url>http://repo.syncleus.com/repository/snapshots/</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - - <repository> - <id>dependencies</id> - <name>Syncleus Maven Dependencies Repository</name> - <url>http://repo.syncleus.com/repository/dependencies/</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> + <dependency> + <groupId>java3d</groupId> + <artifactId>j3d-core</artifactId> + </dependency> - </repositories> + <dependency> + <groupId>java3d</groupId> + <artifactId>j3d-core-utils</artifactId> + </dependency> + </dependencies> </project> diff --git a/src/main/java/com/syncleus/dann/classify/naive/bayes/package-info.java b/src/main/java/com/syncleus/dann/classify/naive/bayes/package-info.java index bdee7a7f..2806a661 100644 --- a/src/main/java/com/syncleus/dann/classify/naive/bayes/package-info.java +++ b/src/main/java/com/syncleus/dann/classify/naive/bayes/package-info.java @@ -20,8 +20,7 @@ /** * This package contains naive classifiers using Bayes' theorem. - * See <a href=" - * http://en.wikipedia.org/wiki/Statistical_classification#Bayesian_procedures"> + * See <a href="http://en.wikipedia.org/wiki/Statistical_classification#Bayesian_procedures"> * Statistical classification - Bayesian procedures</a>. */ package com.syncleus.dann.classify.naive.bayes; diff --git a/src/main/java/com/syncleus/dann/genetics/wavelets/ExpressionFunction.java b/src/main/java/com/syncleus/dann/genetics/wavelets/ExpressionFunction.java index 2900bcf1..cde2f673 100644 --- a/src/main/java/com/syncleus/dann/genetics/wavelets/ExpressionFunction.java +++ b/src/main/java/com/syncleus/dann/genetics/wavelets/ExpressionFunction.java @@ -172,7 +172,9 @@ public class ExpressionFunction implements Cloneable } /** - * Internally mutates.<br/> <br/> may change in any of the following ways:<br/> + * Internally mutates. + * + * may change in any of the following ways: * <ul> <li>add a new bound wave</li> <li>copy an existing wave and mutates it * adding the new mutated wave</li> <li>delete an existing wave</li> * <li>removing a signal</li> <li>Do nothing</li> </ul> @@ -239,8 +241,10 @@ public class ExpressionFunction implements Cloneable } /** - * Mutates by incorporating a new signal into the mutated result.<br/> <br/> - * May mutate by:<br/> <ul> <li>adding the new signal</li> </ul> + * Mutates by incorporating a new signal into the mutated result. + * + * May mutate by: + * <ul> <li>adding the new signal</li> </ul> * * @param newReceptor The new receptor to possibly incorporate into mutation * @param deviation RANDOM deviation for mutation. diff --git a/src/main/java/com/syncleus/dann/genetics/wavelets/SignalProcessingWavelet.java b/src/main/java/com/syncleus/dann/genetics/wavelets/SignalProcessingWavelet.java index 5a2a5ea7..5a45373b 100644 --- a/src/main/java/com/syncleus/dann/genetics/wavelets/SignalProcessingWavelet.java +++ b/src/main/java/com/syncleus/dann/genetics/wavelets/SignalProcessingWavelet.java @@ -232,7 +232,10 @@ public class SignalProcessingWavelet implements Comparable<SignalProcessingWavel } /** - * Internally mutates.<br/> <br/> may change in any of the following ways:<br/> + * Internally mutates. + * + * may change in any of the following ways: + * * <ul> <li>add a new bound wave</li> <li>copy an existing wave and mutates it * adding the new mutated wave</li> <li>delete an existing wave</li> * <li>removing a signal</li> <li>Do nothing</li> </ul> @@ -317,9 +320,12 @@ public class SignalProcessingWavelet implements Comparable<SignalProcessingWavel } /** - * Mutates by incorporating a new signal into the mutated result.<br/> <br/> - * May mutate by:<br/> <ul> <li>adding the new signal</li> </ul> + * Mutates by incorporating a new signal into the mutated result. + * + * May mutate by: + * <ul> <li>adding the new signal</li> </ul> * + * @param deviation the deviation used. * @param newSignal The new signal to incorporate. * @return New mutated wavelet */ diff --git a/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java b/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java index 90445346..4ad671ac 100644 --- a/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java +++ b/src/main/java/com/syncleus/dann/graph/AbstractAdjacencyGraph.java @@ -63,6 +63,9 @@ public abstract class AbstractAdjacencyGraph<N, E extends TraversableCloud<N>> i /** * Creates a new AbstractAdjacencyGraph with no edges and no adjacencies. + * + * @param contextEnabled determines if element context is enabled or not. If enabled then nodes and edges can + * be alerted to changes in their graph topology. */ protected AbstractAdjacencyGraph(final boolean contextEnabled) { @@ -82,6 +85,9 @@ public abstract class AbstractAdjacencyGraph<N, E extends TraversableCloud<N>> i /** * Creates a new AbstractAdjacencyGraph as a copy of the current Graph. + * + * @param contextEnabled determines if element context is enabled or not. If enabled then nodes and edges can + * be alerted to changes in their graph topology. * @param copyGraph The Graph to copy */ protected AbstractAdjacencyGraph(final Graph<N, E> copyGraph, final boolean contextEnabled) @@ -108,6 +114,8 @@ public abstract class AbstractAdjacencyGraph<N, E extends TraversableCloud<N>> i * the given list of ourEdges. * The adjacency lists are created from this structure. * + * @param contextEnabled determines if element context is enabled or not. If enabled then nodes and edges can + * be alerted to changes in their graph topology. * @param attemptNodes The set of all nodes * @param attemptEdges The set of all ourEdges */ diff --git a/src/main/java/com/syncleus/dann/graph/drawing/hyperassociativemap/visualization/HyperassociativeMapCanvas.java b/src/main/java/com/syncleus/dann/graph/drawing/hyperassociativemap/visualization/HyperassociativeMapCanvas.java index 1b085034..acf6e072 100644 --- a/src/main/java/com/syncleus/dann/graph/drawing/hyperassociativemap/visualization/HyperassociativeMapCanvas.java +++ b/src/main/java/com/syncleus/dann/graph/drawing/hyperassociativemap/visualization/HyperassociativeMapCanvas.java @@ -112,6 +112,7 @@ public class HyperassociativeMapCanvas<G extends Graph<N, ?>, N> extends JPanel * Initializes a new HyperassociativeMapCanvas to represent the specified * HyperassociativeMap. * + * @throws ComponentUnavailableException if Java3D support is not available. * @param ourMap The HyperassociativeMap to display. * @since 1.0 */ @@ -125,6 +126,7 @@ public class HyperassociativeMapCanvas<G extends Graph<N, ?>, N> extends JPanel * HyperassociativeMap and with nodes represented graphically as spheres with * the specified radius. * + * @throws ComponentUnavailableException if Java3D support is not available. * @param ourMap The HyperassociativeMap to display. * @param nodeRadius The radius of the spheres representing each node. * @since 1.0 @@ -138,6 +140,7 @@ public class HyperassociativeMapCanvas<G extends Graph<N, ?>, N> extends JPanel * Initializes a new HyperassociativeMapCanvas to represent the specified * HyperassociativeMap using the specified GraphicsConfiguration. * + * @throws ComponentUnavailableException if Java3D support is not available. * @param ourMap The HyperassociativeMap to display. * @param configuration The GraphicsConfiguration to use for configuring the * canvas. diff --git a/src/main/java/com/syncleus/dann/graph/topological/KnotOptimizedGraph.java b/src/main/java/com/syncleus/dann/graph/topological/KnotOptimizedGraph.java index 7533ab50..38a9f338 100644 --- a/src/main/java/com/syncleus/dann/graph/topological/KnotOptimizedGraph.java +++ b/src/main/java/com/syncleus/dann/graph/topological/KnotOptimizedGraph.java @@ -36,6 +36,7 @@ public interface KnotOptimizedGraph<N, E extends TraversableCloud<N>> extends Gr * connected component of the graph it is weakly connected amongst itself. * * @param knotedNodes A set of nodes to check if they form a knot. + * @param knotedEdges A set of edges to check if they form a knot. * @return true if the specified nodes can be traversed to from outside of the * set, and once the set is entered there is no path to traverse * outside of the set. diff --git a/src/main/java/com/syncleus/dann/graph/topological/StructureOptimizedGraph.java b/src/main/java/com/syncleus/dann/graph/topological/StructureOptimizedGraph.java index 289731ee..32dc5252 100644 --- a/src/main/java/com/syncleus/dann/graph/topological/StructureOptimizedGraph.java +++ b/src/main/java/com/syncleus/dann/graph/topological/StructureOptimizedGraph.java @@ -28,6 +28,7 @@ public interface StructureOptimizedGraph<N, E extends TraversableCloud<N>> exten * also present in this graph. If graph is empty then this will always return * true. * + * @param graph The graph to check to see if it is a subgraph of this graph. * @return true if the specified graph only contains nodes and edges that are * also present in this graph. * @since 2.0 diff --git a/src/main/java/com/syncleus/dann/graph/topological/Topography.java b/src/main/java/com/syncleus/dann/graph/topological/Topography.java index 551e71e1..235baf32 100644 --- a/src/main/java/com/syncleus/dann/graph/topological/Topography.java +++ b/src/main/java/com/syncleus/dann/graph/topological/Topography.java @@ -52,6 +52,10 @@ public final class Topography * connect once to this edge and to one or more other nodes, counting once towards the * degree. However, loop edges can connect twice or more to this node counting multiple * times. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param node The node whose degree is to be returned * @return The degree of this node * @see com.syncleus.dann.graph.topological.Topography#getDegree(Graph,Object) @@ -100,6 +104,10 @@ public final class Topography * Determines whether this graph is strongly connected. * A graph is strongly connected if, and only if every node is strongly * connected to every other node. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @return whether this graph is strongly connected * @see com.syncleus.dann.graph.topological.Topography#isStronglyConnected(Graph) */ @@ -129,6 +137,10 @@ public final class Topography /** * Determines whether this graph is weakly connected. A graph is weakly connected if * there is only one node or every node is weakly connected to every other node. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @return If this graph is weakly connected * @see com.syncleus.dann.graph.topological.Topography#isWeaklyConnected(Graph) */ @@ -162,9 +174,13 @@ public final class Topography /** * Determines whether two nodes are weakly connected. Nodes are weakly connected if * there is some path from the left node to the right node, across any adjacent nodes. - * Assume that the hypothetical <pre>A->B</pre> graph is directional. This graph + * Assume that the hypothetical A->B graph is directional. This graph * would have a strong connection from A to B, but only a weak connection from B to A. * This graph would, therefore, be weakly connected overall, but not strongly connected overall. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param leftNode The left node * @param rightNode The right node * @return Whether there is any connection between the two nodes @@ -212,6 +228,10 @@ public final class Topography * if there is some path from the left node to the right node, across any traversable * nodes. See <code>isWeaklyConnected(N,N)</code> for an example of weak versus strong * connections. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param leftNode The first node to check * @param rightNode The second node to check * @return Whether these nodes are strongly connected @@ -254,6 +274,10 @@ public final class Topography * Gets the set of maximally-connected components from a graph. The maximally-connected * components are those with the most connections to other nodes. * NOTE: This method currently returns null. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @return <code>null</code> * @see com.syncleus.dann.graph.topological.Topography#getMaximallyConnectedComponents(Graph) */ @@ -280,7 +304,11 @@ public final class Topography * Determines whether the given graph is a maximal subgraph of the current graph. * A subgraph is maximal if none of the edges of the parent graph not in the subgraph * connect to any nodes in the subgraph. - * @param subGraph A subgraph of this graph to be checked if maximally + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check + * @param subGraph A subgraph of the graph to be checked if maximally * connected. * @return Whether this is a maximal subgraph * @see com.syncleus.dann.graph.topological.Topography#isMaximalSubgraph(Graph, Graph) @@ -750,6 +778,9 @@ public final class Topography * Simple graphs can not have two nodes connected by two edges differing only * by its direction/navigability. * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @return true if graph has no loops, and all edges have a multiplicity of 0. * @since 2.0 * @see com.syncleus.dann.graph.topological.Topography#isSimple(Graph) @@ -783,6 +814,9 @@ public final class Topography * Determines if every node in this graph has the same degree. If there are no * nodes in the graph this will return true. * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @return true if every node in this graph has the same degree or there are no * nodes, false otherwise. * @since 2.0 @@ -816,6 +850,10 @@ public final class Topography /** * Gets the degree of the regular graph. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @throws IllegalStateException If this graph has no nodes, or the graph is not regular * @return The degree of the regular graph * @see com.syncleus.dann.graph.topological.Topography#getRegularDegree(Graph) @@ -854,6 +892,9 @@ public final class Topography * Determined the largest multiplicty of any node in the graph and return it. * Returns 0 if there are no edges. * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @return the largest multiplicty of any node in the graph and return it. * @since 2.0 * @see com.syncleus.dann.graph.topological.Topography#getMultiplicity(Graph) @@ -887,6 +928,9 @@ public final class Topography * Calculates the number of edges in the graph with the exact set of end nodes * as the specified edge, not including the specified edge itself. * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param edge the edge of which the multiplicity is to be calculated. * @return the number of edges in the graph with the exact set of end nodes as * the specified edge, not including the specified edge itself. @@ -936,6 +980,9 @@ public final class Topography * with the exact same set of nodes, no more and no less, then returns true, * otherwise false. * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param edge the edge to check if it is multiple. * @return true if there is another edge in the graph with the exact same set * of nodes. @@ -989,6 +1036,9 @@ public final class Topography * * NOTE: This method always returns false. * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param knotedNodes A set of nodes to check if they form a knot. * @return false * @since 2.0 @@ -1167,6 +1217,10 @@ public final class Topography * Removes a set of nodes and a set of edges from the given graph. * First, it removes all nodes from the graph. * Then, it removes all edges in the edges to remove that are not connected to the given node. + * + * @param <N> The type of node allowed in the graph + * @param <E> The type of edge allowed in the graph + * @param graph The graph to check * @param deleteNodes The nodes to remove * @param deleteEdges The edges to remove in addition to the nodes * @return an ImmutableAdjacencyGraph with the given nodes and edges removed diff --git a/src/main/java/com/syncleus/dann/math/OrderedFieldElement.java b/src/main/java/com/syncleus/dann/math/OrderedFieldElement.java index fcbf9b37..0e4033ba 100644 --- a/src/main/java/com/syncleus/dann/math/OrderedFieldElement.java +++ b/src/main/java/com/syncleus/dann/math/OrderedFieldElement.java @@ -26,6 +26,8 @@ public interface OrderedFieldElement<F extends OrderedFieldElement<? extends F>> /** * Returns a constant holding the maximum value a field of this type can * have. + * + * @param value the field type which to evaluate * @return the maximum value a field of this type can have. */ F max(F value); @@ -33,6 +35,8 @@ public interface OrderedFieldElement<F extends OrderedFieldElement<? extends F>> /** * Returns a constant holding the minimum value a field of this type can * have. + * + * @param value the field type which to evaluate * @return the minimum value a field of this type can have. */ F min(F value); diff --git a/src/main/java/com/syncleus/dann/math/Vector.java b/src/main/java/com/syncleus/dann/math/Vector.java index ea00ce94..6a86c67d 100644 --- a/src/main/java/com/syncleus/dann/math/Vector.java +++ b/src/main/java/com/syncleus/dann/math/Vector.java @@ -112,6 +112,7 @@ public class Vector implements Serializable /** * Sets the specified coordinate. * + * @return returns a new vector with the new coordinate set. * @param coordinate The new value to set for the coordinate. * @param dimension The dimension of the coordinate to set. * @throws IllegalArgumentException Thrown if the coordinate is less than or @@ -153,6 +154,7 @@ public class Vector implements Serializable * before this method was called if the distance argument is positive. If * the distance argument is negative it will invert the vector as well. * + * @return returns a new vector with the new distance set. * @param distance The new distance for this vector. * @since 1.0 */ @@ -175,6 +177,7 @@ public class Vector implements Serializable * representation of this point. It will keep the other angles and distance * component close to the same. * + * @return returns a new vector with the new angle set. * @param angle New angle to set. * @param dimension Dimension of the angle you want to set. * @throws IllegalArgumentException Thrown if dimension is less than or diff --git a/src/main/java/com/syncleus/dann/math/counting/PermutationCounter.java b/src/main/java/com/syncleus/dann/math/counting/PermutationCounter.java index 8214ca0a..837c8b82 100644 --- a/src/main/java/com/syncleus/dann/math/counting/PermutationCounter.java +++ b/src/main/java/com/syncleus/dann/math/counting/PermutationCounter.java @@ -37,6 +37,9 @@ public class PermutationCounter extends AbstractPermutationCounter * 20! = 2,432,902,008,176,640,000 and * 21! is too big to fit into permutation Java long, which is * why we use BigInteger instead. + * + * @param permutationSize size of the permutation + * @param setSize size of the set */ public PermutationCounter(final int setSize, final int permutationSize) { @@ -47,6 +50,8 @@ public class PermutationCounter extends AbstractPermutationCounter /** * Generates the next permutation (algorithm from Rosen p. 284) + * + * @return true if there is another permutation to retrieve. */ @Override protected boolean next() diff --git a/src/main/java/com/syncleus/dann/math/linear/Matrix.java b/src/main/java/com/syncleus/dann/math/linear/Matrix.java index b513a20c..adc74f4d 100644 --- a/src/main/java/com/syncleus/dann/math/linear/Matrix.java +++ b/src/main/java/com/syncleus/dann/math/linear/Matrix.java @@ -38,6 +38,7 @@ public interface Matrix<M extends Matrix<? extends M, ? extends F>, F extends Fi /** * Set a single element. * + * @return a matrix of the specified dimensions. * @param heightIndex Row index. * @param widthIndex Column index. * @param fillValue value to set diff --git a/src/main/java/com/syncleus/dann/math/linear/SimpleRealMatrix.java b/src/main/java/com/syncleus/dann/math/linear/SimpleRealMatrix.java index ed00c0c8..689eb719 100644 --- a/src/main/java/com/syncleus/dann/math/linear/SimpleRealMatrix.java +++ b/src/main/java/com/syncleus/dann/math/linear/SimpleRealMatrix.java @@ -42,13 +42,15 @@ import org.apache.log4j.Logger; * Methods for reading and printing matrices are also included. All the * operations in this version of the SimpleRealMatrix Class involve real * matrices. Complex matrices may be handled in a future version. - * <p/> + * * Five fundamental matrix decompositions, which consist of pairs or triples of * matrices, permutation vectors, and the like, produce results in five * decomposition classes. These decompositions are accessed by the * SimpleRealMatrix class to compute solutions of simultaneous linear equations, * determinants, inverses and other matrix functions. The five decompositions - * are: <P><UL> <LI>Cholesky Decomposition of symmetric, positive definite + * are: + * + * <UL> <LI>Cholesky Decomposition of symmetric, positive definite * matrices. <LI>LU Decomposition of rectangular matrices. <LI>QR Decomposition * of rectangular matrices. <LI>Singular Value Decomposition of rectangular * matrices. <LI>Eigenvalue Decomposition of both symmetric and non-symmetric @@ -165,6 +167,7 @@ public class SimpleRealMatrix implements Cloneable, Serializable, RealMatrix /** * Construct a matrix from a copy of a 2-D array. * + * @return a new matrix copying the elements specified. * @param matrixElements Two-dimensional array of doubles. * @throws IllegalArgumentException All rows must have the same length */ @@ -175,6 +178,8 @@ public class SimpleRealMatrix implements Cloneable, Serializable, RealMatrix /** * Creates a deep copy of a matrix. + * + * @return A new RealMatrix representing a deep copy of this matrix. */ public RealMatrix copy() { diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyBanachiewiczCholeskyDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyBanachiewiczCholeskyDecomposition.java index ec8de13b..862a8d72 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyBanachiewiczCholeskyDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyBanachiewiczCholeskyDecomposition.java @@ -28,10 +28,10 @@ import com.syncleus.dann.math.linear.Matrix; /** * Cholesky Decomposition. - * <p/> + * * For a symmetric, positive definite matrix A, the Cholesky decomposition is an * lower triangular matrix L so that A = L*L'. - * <p/> + * * If the matrix is not symmetric or positive definite, the constructor returns * a partial decomposition and sets an internal flag that may be queried by the * isSpd() method. diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyCroutCholeskyDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyCroutCholeskyDecomposition.java index fd241317..822fd46b 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyCroutCholeskyDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyCroutCholeskyDecomposition.java @@ -37,9 +37,9 @@ public class CholeskyCroutCholeskyDecomposition<M extends Matrix<M, F>, F extend /** * Right Triangular Cholesky Decomposition. - * <p/> + * * Cholesky algorithm for symmetric and positive definite matrix. - * <p/> + * * For a symmetric, positive definite matrix A, the Right Cholesky * decomposition is an upper triangular matrix R so that A = R'*R. This * constructor computes R with the Fortran inspired column oriented algorithm diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyDecomposition.java index 708ce264..1b4432c7 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/CholeskyDecomposition.java @@ -23,10 +23,10 @@ import com.syncleus.dann.math.linear.Matrix; /** * Cholesky Decomposition. - * <p/> + * * For a symmetric, positive definite matrix A, the Cholesky decomposition is an * lower triangular matrix L so that A = L*L'. - * <p/> + * * If the matrix is not symmetric or positive definite, the constructor returns * a partial decomposition and sets an internal flag that may be queried by the * isSpd() method. diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/DoolittleLuDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/DoolittleLuDecomposition.java index 8c52c62a..985e3a4a 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/DoolittleLuDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/DoolittleLuDecomposition.java @@ -32,14 +32,14 @@ import com.syncleus.dann.math.linear.Matrix; /** * matrixToDecomposeElements Decomposition. - * <p/> - * For an height-by-width matrix matrixToDecompose with height >= width, the + * + * For an height-by-width matrix matrixToDecompose with height >= width, the * matrixToDecomposeElements decomposition is an height-by-width unit lower * triangular matrix lowerTriangularFactor, an width-by-width upper triangular * matrix U, and a permutation vector pivot of length height so that - * matrixToDecompose(pivot,:) = lowerTriangularFactor*U. If height < width, then + * matrixToDecompose(pivot,:) = lowerTriangularFactor*U. If height < width, then * lowerTriangularFactor is height-by-height and U is height-by-width. - * <p/> + * * The matrixToDecomposeElements decomposition with pivoting always exists, even * if the matrix is singular, so the constructor will never fail. The primary * use of the matrixToDecomposeElements decomposition is in the solution of diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/HouseholderQrDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/HouseholderQrDecomposition.java index 2cfdd5b8..96478cb3 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/HouseholderQrDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/HouseholderQrDecomposition.java @@ -32,11 +32,11 @@ import com.syncleus.dann.math.linear.Matrix; /** * QR Decomposition. - * <p/> - * For an m-by-n matrix matrixToDecompose with m >= n, the QR decomposition is + * + * For an m-by-n matrix matrixToDecompose with m >= n, the QR decomposition is * an m-by-n orthogonal matrix factor and an n-by-n upper triangular matrix * factor so that matrixToDecompose = factor*factor. - * <p/> + * * The QR decomposition always exists, even if the matrix does not have full * rank, so the constructor will never fail. The primary use of the QR * decomposition is in the least squares solution of non-square systems of diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/LuDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/LuDecomposition.java index 0f97ca5b..6eb78837 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/LuDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/LuDecomposition.java @@ -23,14 +23,14 @@ import com.syncleus.dann.math.linear.Matrix; /** * matrixToDecomposeElements Decomposition. - * <p/> - * For an height-by-width matrix matrixToDecompose with height >= width, the + * + * For an height-by-width matrix matrixToDecompose with height >= width, the * matrixToDecomposeElements decomposition is an height-by-width unit lower * triangular matrix lowerTriangularFactor, an width-by-width upper triangular * matrix U, and a permutation vector pivot of length height so that - * matrixToDecompose(pivot,:) = lowerTriangularFactor*U. If height < width, then + * matrixToDecompose(pivot,:) = lowerTriangularFactor*U. If height < width, then * lowerTriangularFactor is height-by-height and U is height-by-width. - * <p/> + * * The matrixToDecomposeElements decompostion with pivoting always exists, even * if the matrix is singular, so the constructor will never fail. The primary * use of the matrixToDecomposeElements decomposition is in the solution of diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/QrDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/QrDecomposition.java index e02ee2b1..7d83fab8 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/QrDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/QrDecomposition.java @@ -23,11 +23,11 @@ import com.syncleus.dann.math.linear.Matrix; /** * QR Decomposition. - * <p/> - * For an m-by-n matrix matrixToDecompose with m >= n, the QR decomposition is + * + * For an m-by-n matrix matrixToDecompose with m >= n, the QR decomposition is * an m-by-n orthogonal matrix factor and an n-by-n upper triangular matrix * factor so that matrixToDecompose = factor*factor. - * <p/> + * * The QR decompostion always exists, even if the matrix does not have full * rank, so the constructor will never fail. The primary use of the QR * decomposition is in the least squares solution of nonsquare systems of diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/SingularValueDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/SingularValueDecomposition.java index 5b89790b..fc85164f 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/SingularValueDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/SingularValueDecomposition.java @@ -24,17 +24,17 @@ import com.syncleus.dann.math.linear.RealMatrix; /** * Singular Value Decomposition. - * <p/> - * For an m-by-n matrix A with m >= n, the singular value decomposition is an + * + * For an m-by-n matrix A with m >= n, the singular value decomposition is an * m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and an n-by-n * orthogonal matrix V so that A = U*S*V'. - * <p/> - * The singular values, sigma[k] = S[k][k], are ordered so that sigma[0] >= - * sigma[1] >= ... >= sigma[n-1]. - * <p/> + * + * The singular values, sigma[k] = S[k][k], are ordered so that sigma[0] >= + * sigma[1] >= ... >= sigma[n-1]. + * * The singular value decompostion always exists, so the constructor will never * fail. The matrix condition number and the effective numerical rank can be - * computed from this decomposition.<br/> + * computed from this decomposition. */ public interface SingularValueDecomposition extends Decomposition<RealMatrix> { diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/StewartSingularValueDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/StewartSingularValueDecomposition.java index 7b71650f..ca146bae 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/StewartSingularValueDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/StewartSingularValueDecomposition.java @@ -31,20 +31,20 @@ import com.syncleus.dann.math.linear.SimpleRealMatrix; /** * Singular Value Decomposition. - * <p/> - * For an m-by-n matrix A with m >= n, the singular value decomposition is an + * + * For an m-by-n matrix A with m >= n, the singular value decomposition is an * m-by-n orthogonal matrix leftSingularMatrix, an n-by-n diagonal matrix S, and * an n-by-n orthogonal matrix rightSingularMatrix so that A = * leftSingularMatrix*S*rightSingularMatrix'. - * <p/> - * The singular values, sigma[k] = S[k][k], are ordered so that sigma[0] >= - * sigma[1] >= ... >= sigma[n-1]. - * <p/> + * + * The singular values, sigma[k] = S[k][k], are ordered so that sigma[0] >= + * sigma[1] >= ... >= sigma[n-1]. + * * The singular value decomposition always exists, so the constructor will never * fail. The matrix condition number and the effective numerical rank can be - * computed from this decomposition.<br/> Algorithm taken from: G.W. Stewart, - * university of Maryland, Argonne national lab. C - * @author Jeffrey Phillips Freeman + * computed from this decomposition. + * + * Algorithm taken from: G.W. Stewart. university of Maryland, Argonne national lab. C */ public class StewartSingularValueDecomposition implements java.io.Serializable, SingularValueDecomposition { diff --git a/src/main/java/com/syncleus/dann/math/linear/decomposition/TridiagonalEignevalueDecomposition.java b/src/main/java/com/syncleus/dann/math/linear/decomposition/TridiagonalEignevalueDecomposition.java index b9b9b5a3..c320b130 100644 --- a/src/main/java/com/syncleus/dann/math/linear/decomposition/TridiagonalEignevalueDecomposition.java +++ b/src/main/java/com/syncleus/dann/math/linear/decomposition/TridiagonalEignevalueDecomposition.java @@ -32,14 +32,14 @@ import com.syncleus.dann.math.linear.SimpleRealMatrix; /** * Eigenvalues and eigenvectors of a real matrix. - * <p/> + * * If matrixToDecomposeElements is symmetric, then matrixToDecomposeElements = * matrixElements*D*matrixElements' where the eigenvalue matrix D is diagonal * and the eigenvector matrix matrixElements is orthogonal. I.e. * matrixToDecomposeElements = matrixElements.times(D.times(matrixElements.transpose())) * and matrixElements.times(matrixElements.transpose()) equals the identity * matrix. - * <p/> + * * If matrixToDecomposeElements is not symmetric, then the eigenvalue matrix D * is block diagonal with the real eigenvalues in 1-by-1 blocks and any complex * eigenvalues, lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The diff --git a/src/main/java/com/syncleus/dann/math/visualization/MathFunctionCanvas.java b/src/main/java/com/syncleus/dann/math/visualization/MathFunctionCanvas.java deleted file mode 100644 index 5e47db58..00000000 --- a/src/main/java/com/syncleus/dann/math/visualization/MathFunctionCanvas.java +++ /dev/null @@ -1,167 +0,0 @@ -/****************************************************************************** - * * - * Copyright: (c) Syncleus, Inc. * - * * - * You may redistribute and modify this source code under the terms and * - * conditions of the Open Source Community License - Type C version 1.0 * - * or any later version as published by Syncleus, Inc. at www.syncleus.com. * - * There should be a copy of the license included with this file. If a copy * - * of the license is not included you are granted no right to distribute or * - * otherwise use this file except through a legal and valid license. You * - * should also contact Syncleus, Inc. at the information below if you cannot * - * find a license: * - * * - * Syncleus, Inc. * - * 2604 South 12th Street * - * Philadelphia, PA 19148 * - * * - ******************************************************************************/ -package com.syncleus.dann.math.visualization; - -import com.syncleus.dann.math.Function; -import org.freehep.j3d.plot.Binned2DData; -import org.freehep.j3d.plot.SurfacePlot; - -public class MathFunctionCanvas extends SurfacePlot -{ - private static final long serialVersionUID = -6107827702991178553L; - private Function function; - private int xIndex; - private int yIndex; - private float xMin; - private float xMax; - private float yMin; - private float yMax; - private int resolution; - - public MathFunctionCanvas(final Function function, final String xParameter, final String yParameter, final float xMin, final float xMax, final float yMin, final float yMax, final int resolution) - { - super(); - - this.function = function; - this.xIndex = this.function.getParameterNameIndex(xParameter); - this.yIndex = this.function.getParameterNameIndex(yParameter); - this.xMin = xMin; - this.xMax = xMax; - this.yMin = yMin; - this.yMax = yMax; - this.resolution = resolution; - this.setLogZscaling(false); - this.refresh(); - } - - private void refresh() - { - final MathFunctionDataBinder dataBinder = new MathFunctionDataBinder( - this.function, - this.function.getParameterName(this.xIndex), - this.function.getParameterName(this.yIndex), - this.xMin, - this.xMax, - this.yMin, - this.yMax, - this.resolution); - super.setData(dataBinder); - } - - public void setFunction(final Function newFunction, final String xParameter, final String yParameter) - { - this.function = newFunction; - this.xIndex = this.function.getParameterNameIndex(xParameter); - this.yIndex = this.function.getParameterNameIndex(yParameter); - - this.refresh(); - } - - public Function getFunction() - { - return this.function; - } - - public int getXIndex() - { - return this.xIndex; - } - - public int getYIndex() - { - return this.yIndex; - } - - public int getResolution() - { - return this.resolution; - } - - public float getXMax() - { - return this.xMax; - } - - public float getXMin() - { - return this.xMin; - } - - public float getYMax() - { - return this.yMax; - } - - public float getYMin() - { - return this.yMin; - } - - @Override - public void setData(final Binned2DData data) - { - if( data instanceof MathFunctionDataBinder ) - { - final MathFunctionDataBinder mathFunctionData = (MathFunctionDataBinder) data; - - this.function = mathFunctionData.getFunction(); - this.xIndex = mathFunctionData.getXIndex(); - this.yIndex = mathFunctionData.getYIndex(); - this.setXMin(mathFunctionData.xMin()); - this.setXMax(mathFunctionData.xMax()); - this.setYMin(mathFunctionData.yMin()); - this.setYMax(mathFunctionData.yMax()); - this.setResolution(mathFunctionData.getResolution()); - - this.refresh(); - } - else - throw new IllegalArgumentException("data must be a MathFunction3dDataBinder"); - } - - public void setXMin(final float xMin) - { - this.xMin = xMin; - this.refresh(); - } - - public void setXMax(final float xMax) - { - this.xMax = xMax; - this.refresh(); - } - - public void setYMin(final float yMin) - { - this.yMin = yMin; - this.refresh(); - } - - public void setYMax(final float yMax) - { - this.yMax = yMax; - this.refresh(); - } - - public void setResolution(final int resolution) - { - this.resolution = resolution; - this.refresh(); - } -} diff --git a/src/main/java/com/syncleus/dann/math/visualization/MathFunctionDataBinder.java b/src/main/java/com/syncleus/dann/math/visualization/MathFunctionDataBinder.java deleted file mode 100644 index 38e06d0c..00000000 --- a/src/main/java/com/syncleus/dann/math/visualization/MathFunctionDataBinder.java +++ /dev/null @@ -1,239 +0,0 @@ -/****************************************************************************** - * * - * Copyright: (c) Syncleus, Inc. * - * * - * You may redistribute and modify this source code under the terms and * - * conditions of the Open Source Community License - Type C version 1.0 * - * or any later version as published by Syncleus, Inc. at www.syncleus.com. * - * There should be a copy of the license included with this file. If a copy * - * of the license is not included you are granted no right to distribute or * - * otherwise use this file except through a legal and valid license. You * - * should also contact Syncleus, Inc. at the information below if you cannot * - * find a license: * - * * - * Syncleus, Inc. * - * 2604 South 12th Street * - * Philadelphia, PA 19148 * - * * - ******************************************************************************/ -package com.syncleus.dann.math.visualization; - -import java.awt.Color; -import javax.vecmath.Color3b; -import org.freehep.j3d.plot.Binned2DData; -import com.syncleus.dann.math.Function; - -public final class MathFunctionDataBinder implements Binned2DData -{ - private final Function function; - private final int functionXIndex; - private final int functionYIndex; - private final float minX; - private final float maxX; - private final float minY; - private final float maxY; - private final float minZ; - private final float maxZ; - private final int resolution; - - public MathFunctionDataBinder(final Function function, - final String functionXParam, - final String functionYParam, - final float xMin, - final float xMax, - final float yMin, - final float yMax, - final int resolution) - { - if( resolution <= 0 ) - throw new IllegalArgumentException("resolution must be greater than 0"); - this.function = function; - this.functionXIndex = this.function.getParameterNameIndex(functionXParam); - this.functionYIndex = this.function.getParameterNameIndex(functionYParam); - this.minX = xMin; - this.maxX = xMax; - this.minY = yMin; - this.maxY = yMax; - this.resolution = resolution; - boolean zMaxSet = false; - boolean zMinSet = false; - float newZMax = 1.0f; - float newZMin = -1.0f; - for(int xIndex = 0; xIndex < this.xBins(); xIndex++) - { - this.setX(this.convertFromXIndex(xIndex)); - for(int yIndex = 0; yIndex < this.yBins(); yIndex++) - { - this.setY(this.convertFromYIndex(yIndex)); - final float currentZ = (float) this.calculateZ(); - if( !Float.isNaN(currentZ) ) - { - if( (newZMax < currentZ) || (!zMaxSet) ) - { - newZMax = currentZ; - zMaxSet = true; - } - if( (newZMin > currentZ) || (!zMinSet) ) - { - newZMin = currentZ; - zMinSet = true; - } - } - } - } - if( newZMax == newZMin ) - { - newZMax += (float) 1.0; - newZMin -= (float) 1.0; - } - this.maxZ = newZMax; - this.minZ = newZMin; - assert ((!Float.isNaN(this.maxZ)) && (!Float.isNaN(this.minZ))); - } - - private float convertFromXIndex(final int xCoord) - { - final float xSize = this.maxX - this.minX; - return (((float) xCoord) / ((float) this.xBins())) * xSize + this.minX; - } - - private float convertFromYIndex(final int yCoord) - { - final float ySize = this.maxY - this.minY; - return (((float) (this.yBins() - yCoord)) / ((float) this.yBins())) * ySize + this.minY; - } - - public Function getFunction() - { - return this.function; - } - - public int getXIndex() - { - return this.functionXIndex; - } - - public int getYIndex() - { - return this.functionYIndex; - } - - public int getResolution() - { - return this.resolution; - } - - private void setX(final double xCoord) - { - this.function.setParameter(this.functionXIndex, xCoord); - } - - private void setY(final double yCoord) - { - this.function.setParameter(this.functionYIndex, yCoord); - } - - private double calculateZ() - { - return this.function.calculate(); - } - - private Color colorAtPoint(final int xIndex, final int yIndex) - { - final float xCoord = this.convertFromXIndex(xIndex); - final float yCoord = this.convertFromYIndex(yIndex); - - this.setX(xCoord); - this.setY(yCoord); - final double zCoord = this.calculateZ(); - - - if( zCoord > this.maxZ ) - return new Color(0.0f, 0.0f, 0.0f); - else if( zCoord < this.minZ ) - return new Color(0.0f, 0.0f, 0.0f); - else - { - final float redValue = (float) (zCoord - this.minZ) / (this.maxZ - this.minZ); - final float blueValue = 1.0f - redValue; - final float greenValue = 0.0f; - - return new Color(redValue, greenValue, blueValue); - } - } - - @Override - public Color3b colorAt(final int xIndex, final int yIndex) - { - return new Color3b(colorAtPoint(xIndex, yIndex)); - } - - @Override - public int xBins() - { - return this.resolution; - } - - @Override - public float xMax() - { - return this.maxX; - } - - @Override - public float xMin() - { - return this.minX; - } - - @Override - public int yBins() - { - return this.resolution; - } - - @Override - public float yMax() - { - return this.maxY; - } - - @Override - public float yMin() - { - return this.minY; - } - - @Override - public float zAt(final int xIndex, final int yIndex) - { - final float xCoord = this.convertFromXIndex(xIndex); - final float yCoord = this.convertFromYIndex(yIndex); - - this.setX(xCoord); - this.setY(yCoord); - final float zCoord = (float) this.calculateZ(); - - - if( zCoord < this.minZ ) - return this.minZ; - else if( zCoord > this.maxZ ) - return this.maxZ; - else if( Float.isNaN(zCoord) ) - return 0.0f; - else - return zCoord; - } - - @Override - public float zMax() - { - return this.maxZ; - } - - @Override - public float zMin() - { - return this.minZ; - } -} diff --git a/src/main/java/com/syncleus/dann/neural/AbstractActivationNeuron.java b/src/main/java/com/syncleus/dann/neural/AbstractActivationNeuron.java index 8a62331c..3d2183e6 100644 --- a/src/main/java/com/syncleus/dann/neural/AbstractActivationNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/AbstractActivationNeuron.java @@ -55,6 +55,7 @@ public abstract class AbstractActivationNeuron extends AbstractNeuron * Creates a new instance of NeuronImpl with a RANDOM bias weight and * HyperbolicTangentActivationFunction as the activation function. * + * @param brain The brain which contains this neuron. * @since 1.0 */ protected AbstractActivationNeuron(final Brain<InputNeuron, OutputNeuron, Neuron, Synapse<Neuron>> brain) @@ -67,6 +68,7 @@ public abstract class AbstractActivationNeuron extends AbstractNeuron * Creates a new instance of NeuronImpl with a RANDOM bias weight and the * specified activation function. * + * @param brain The brain which contains this neuron. * @param activationFunction The activation function used to calculate the * output from the neuron's activity. * @since 1.0 diff --git a/src/main/java/com/syncleus/dann/neural/AbstractLocalBrain.java b/src/main/java/com/syncleus/dann/neural/AbstractLocalBrain.java index 3635ba26..7460e3b0 100644 --- a/src/main/java/com/syncleus/dann/neural/AbstractLocalBrain.java +++ b/src/main/java/com/syncleus/dann/neural/AbstractLocalBrain.java @@ -37,8 +37,9 @@ import com.syncleus.dann.graph.topological.StrongConnectivityOptimizedGraph; /** * Represents a single artificial brain typically belonging to a single * artificial organism. It will contain a set of input and output neurons which - * corelate to a specific dataset pattern.<br/> <br/> This class is abstract - * and must be extended in order to be used. + * corelate to a specific dataset pattern. + * + * This class is abstract and must be extended in order to be used. * * @author Jeffrey Phillips Freeman * @since 1.0 @@ -118,6 +119,7 @@ public abstract class AbstractLocalBrain<IN extends InputNeuron, ON extends Outp * Adds a new neuron to the brain. The construction of the brain is done by * the child class so this method is protected. * + * @return true if neuron was added to the graph, false otherwise. * @param newNeuron The neuron to add to the brain. * @since 1.0 */ @@ -145,6 +147,7 @@ public abstract class AbstractLocalBrain<IN extends InputNeuron, ON extends Outp * Adds a new collection of neurons to the brain. The construction of the brain * is done by the child class so this method is protected. * + * @return true if neuron was added to the graph, false otherwise. * @param newNeurons The collection of neurons to add. * @since 1.0 */ @@ -238,6 +241,7 @@ public abstract class AbstractLocalBrain<IN extends InputNeuron, ON extends Outp * Removes the specified neuron from the brain. This only removes it from * the collection of neurons it does not disconnect it from other neurons. * + * @return true if neuron was removed from the graph, false otherwise. * @param removeNeuron The neuron to remove. * @since 1.0 */ diff --git a/src/main/java/com/syncleus/dann/neural/AbstractNeuron.java b/src/main/java/com/syncleus/dann/neural/AbstractNeuron.java index eb60c99d..b50bc7c8 100644 --- a/src/main/java/com/syncleus/dann/neural/AbstractNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/AbstractNeuron.java @@ -34,6 +34,7 @@ public abstract class AbstractNeuron implements Neuron * Creates a new instance of NeuronImpl with a RANDOM bias weight and * HyperbolicTangentActivationFunction as the activation function. * + * @param brain The brain which contains this neuron. * @since 1.0 */ protected AbstractNeuron(final Brain<InputNeuron, OutputNeuron, Neuron, Synapse<Neuron>> brain) diff --git a/src/main/java/com/syncleus/dann/neural/AbstractSynapse.java b/src/main/java/com/syncleus/dann/neural/AbstractSynapse.java index bbbd790b..8559e4f0 100644 --- a/src/main/java/com/syncleus/dann/neural/AbstractSynapse.java +++ b/src/main/java/com/syncleus/dann/neural/AbstractSynapse.java @@ -69,6 +69,8 @@ public abstract class AbstractSynapse<N> extends AbstractDirectedEdge<N> impleme /** * Creates a new instance of AbstractSynapse. * + * @param contextEnabled true if context awareness is enabled in this synapse + * @param allowJoiningMultipleGraphs True if the synapse is allowed to exist in more than one graph at a time. * @param sourceToSet The incoming neuron connection. * @param destinationToSet The outgoing neuron connection. * @param initialWeight The initial weight of the synapse @@ -83,6 +85,8 @@ public abstract class AbstractSynapse<N> extends AbstractDirectedEdge<N> impleme /** * Creates a new instance of AbstractSynapse. * + * @param contextEnabled true if context awareness is enabled in this synapse + * @param allowJoiningMultipleGraphs True if the synapse is allowed to exist in more than one graph at a time. * @param sourceToSet The incoming neuron connection. * @param destinationToSet The outgoing neuron connection. * @since 1.0 diff --git a/src/main/java/com/syncleus/dann/neural/NeuronGroup.java b/src/main/java/com/syncleus/dann/neural/NeuronGroup.java index 8f0be7ee..70907b0c 100644 --- a/src/main/java/com/syncleus/dann/neural/NeuronGroup.java +++ b/src/main/java/com/syncleus/dann/neural/NeuronGroup.java @@ -111,6 +111,7 @@ public class NeuronGroup<N extends Neuron> implements java.io.Serializable /** * Obtains all the Neurons directly owned by this NeuronGroup. * + * @return A set of all neurons directly owned by this group. * @since 1.0 */ public Set<N> getChildrenNeurons() @@ -121,6 +122,7 @@ public class NeuronGroup<N extends Neuron> implements java.io.Serializable /** * Obtains all the NeuronGroups directly owned by this NeuronGroup. * + * @return A set of all NeuronGroups owned directly by this group. * @since 1.0 */ public Set<NeuronGroup<? extends N>> getChildrenNeuronGroups() @@ -130,8 +132,9 @@ public class NeuronGroup<N extends Neuron> implements java.io.Serializable /** * Obtains all the NetworkNodes owned recursively excluding - * NeuronGroups.<BR> + * NeuronGroups. * + * @return a set of all the NetworkNodes owned recursively by this group, excluding NeuronGroups. * @since 1.0 */ public Set<N> getChildrenNeuronsRecursivly() diff --git a/src/main/java/com/syncleus/dann/neural/SimpleSynapse.java b/src/main/java/com/syncleus/dann/neural/SimpleSynapse.java index b302f6bf..3750ac7c 100644 --- a/src/main/java/com/syncleus/dann/neural/SimpleSynapse.java +++ b/src/main/java/com/syncleus/dann/neural/SimpleSynapse.java @@ -59,6 +59,8 @@ public final class SimpleSynapse<N> extends AbstractSynapse<N> /** * Creates a new instance of SimpleSynapse. * + * @param contextEnabled true if context awareness is enabled in this synapse + * @param allowJoiningMultipleGraphs True if the synapse is allowed to exist in more than one graph at a time. * @param sourceToSet The incoming neuron connection. * @param destinationToSet The outgoing neuron connection. * @param initialWeight The initial weight of the synapse @@ -72,6 +74,8 @@ public final class SimpleSynapse<N> extends AbstractSynapse<N> /** * Creates a new instance of SimpleSynapse. * + * @param contextEnabled true if context awareness is enabled in this synapse + * @param allowJoiningMultipleGraphs True if the synapse is allowed to exist in more than one graph at a time. * @param sourceToSet The incoming neuron connection. * @param destinationToSet The outgoing neuron connection. * @since 1.0 diff --git a/src/main/java/com/syncleus/dann/neural/backprop/AbstractBackpropNeuron.java b/src/main/java/com/syncleus/dann/neural/backprop/AbstractBackpropNeuron.java index 1cbb3dab..458bada8 100644 --- a/src/main/java/com/syncleus/dann/neural/backprop/AbstractBackpropNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/backprop/AbstractBackpropNeuron.java @@ -50,6 +50,7 @@ public abstract class AbstractBackpropNeuron extends AbstractActivationNeuron im /** * Creates a new default instance of SimpleBackpropNeuron. * + * @param brain The brain which contains this neuron. * @since 1.0 */ protected AbstractBackpropNeuron(final Brain brain) @@ -61,6 +62,7 @@ public abstract class AbstractBackpropNeuron extends AbstractActivationNeuron im * Creates a new instance of SimpleBackpropNeuron with the specified * activation function. * + * @param brain The brain which contains this neuron. * @param activationFunction The Neuron's activation function. * @since 1.0 */ @@ -73,6 +75,7 @@ public abstract class AbstractBackpropNeuron extends AbstractActivationNeuron im * Creates a new instance of a SimpleBackpropNeuron using the default * activation function with the specified learning rate. * + * @param brain The brain which contains this neuron. * @param learningRate learning rate of this neuron. * @since 1.0 */ @@ -86,6 +89,7 @@ public abstract class AbstractBackpropNeuron extends AbstractActivationNeuron im * Creates a new instance of a SimpleBackpropNeuron with the specified * activation function and learning rate. * + * @param brain The brain which contains this neuron. * @param activationFunction Activation function for this neuron. * @param learningRate Learning rate for this neuron. */ diff --git a/src/main/java/com/syncleus/dann/neural/backprop/AbstractOutputBackpropNeuron.java b/src/main/java/com/syncleus/dann/neural/backprop/AbstractOutputBackpropNeuron.java index 0d99d092..16c0af14 100644 --- a/src/main/java/com/syncleus/dann/neural/backprop/AbstractOutputBackpropNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/backprop/AbstractOutputBackpropNeuron.java @@ -35,6 +35,7 @@ public abstract class AbstractOutputBackpropNeuron extends AbstractBackpropNeuro /** * Creates a new instance of OutputBackpropNeuron. * + * @param brain The brain which contains this neuron. * @since 1.0 */ protected AbstractOutputBackpropNeuron(final Brain brain) @@ -46,6 +47,7 @@ public abstract class AbstractOutputBackpropNeuron extends AbstractBackpropNeuro * Creates a new instance of OutputBackpropNeuron using the specified * activation function. * + * @param brain The brain which contains this neuron. * @param activationFunction The activation function to use. * @since 1.0 */ @@ -57,6 +59,7 @@ public abstract class AbstractOutputBackpropNeuron extends AbstractBackpropNeuro /** * Creates a new instance of this class using the specified learning rate. * + * @param brain The brain which contains this neuron. * @param learningRate The learning rate for this neuron. * @since 1.0 */ @@ -69,6 +72,7 @@ public abstract class AbstractOutputBackpropNeuron extends AbstractBackpropNeuro * Creates a new instance of this class with the specified activation * function and learning rate. * + * @param brain The brain which contains this neuron. * @param activationFunction The activation used by this neuron. * @param learningRate The learning rate for this neuron. * @since 1.0 diff --git a/src/main/java/com/syncleus/dann/neural/backprop/SimpleBackpropNeuron.java b/src/main/java/com/syncleus/dann/neural/backprop/SimpleBackpropNeuron.java index aa9c94ae..62f1847f 100644 --- a/src/main/java/com/syncleus/dann/neural/backprop/SimpleBackpropNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/backprop/SimpleBackpropNeuron.java @@ -38,6 +38,7 @@ public final class SimpleBackpropNeuron extends AbstractBackpropNeuron /** * Creates a new default instance of SimpleBackpropNeuron. * + * @param brain The brain which contains this neuron. * @since 1.0 */ public SimpleBackpropNeuron(final Brain brain) @@ -49,6 +50,7 @@ public final class SimpleBackpropNeuron extends AbstractBackpropNeuron * Creates a new instance of SimpleBackpropNeuron with the specified * activation function. * + * @param brain The brain which contains this neuron. * @param activationFunction The Neuron's activation function. * @since 1.0 */ @@ -61,6 +63,7 @@ public final class SimpleBackpropNeuron extends AbstractBackpropNeuron * Creates a new instance of a SimpleBackpropNeuron using the default * activation function with the specified learning rate. * + * @param brain The brain which contains this neuron. * @param learningRate learning rate of this neuron. * @since 1.0 */ @@ -73,6 +76,8 @@ public final class SimpleBackpropNeuron extends AbstractBackpropNeuron * Creates a new instance of a SimpleBackpropNeuron with the specified * activation function and learning rate. * + * + * @param brain The brain which contains this neuron. * @param activationFunction Activation function for this neuron. * @param learningRate Learning rate for this neuron. */ diff --git a/src/main/java/com/syncleus/dann/neural/backprop/SimpleOutputBackpropNeuron.java b/src/main/java/com/syncleus/dann/neural/backprop/SimpleOutputBackpropNeuron.java index f15cd658..38e1f3bc 100644 --- a/src/main/java/com/syncleus/dann/neural/backprop/SimpleOutputBackpropNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/backprop/SimpleOutputBackpropNeuron.java @@ -35,6 +35,7 @@ public final class SimpleOutputBackpropNeuron extends AbstractOutputBackpropNeur /** * Creates a new instance of OutputBackpropNeuron. * + * @param brain The brain which contains this neuron. * @since 1.0 */ public SimpleOutputBackpropNeuron(final Brain brain) @@ -46,6 +47,7 @@ public final class SimpleOutputBackpropNeuron extends AbstractOutputBackpropNeur * Creates a new instance of OutputBackpropNeuron using the specified * activation function. * + * @param brain The brain which contains this neuron. * @param activationFunction The activation function to use. * @since 1.0 */ @@ -57,6 +59,7 @@ public final class SimpleOutputBackpropNeuron extends AbstractOutputBackpropNeur /** * Creates a new instance of this class using the specified learning rate. * + * @param brain The brain which contains this neuron. * @param learningRate The learning rate for this neuron. * @since 1.0 */ @@ -69,6 +72,7 @@ public final class SimpleOutputBackpropNeuron extends AbstractOutputBackpropNeur * Creates a new instance of this class with the specified activation function * and learning rate. * + * @param brain The brain which contains this neuron. * @param activationFunction The activation used by this neuron. * @param learningRate The learning rate for this neuron. * @since 1.0 diff --git a/src/main/java/com/syncleus/dann/neural/backprop/brain/FullyConnectedFeedforwardBrain.java b/src/main/java/com/syncleus/dann/neural/backprop/brain/FullyConnectedFeedforwardBrain.java index 8e85c5d4..83ad6082 100644 --- a/src/main/java/com/syncleus/dann/neural/backprop/brain/FullyConnectedFeedforwardBrain.java +++ b/src/main/java/com/syncleus/dann/neural/backprop/brain/FullyConnectedFeedforwardBrain.java @@ -37,6 +37,10 @@ public final class FullyConnectedFeedforwardBrain<IN extends InputBackpropNeuron /** * Uses the given threadExecutor for executing tasks. * + * @param neuronsPerLayer an array of integers, each element in the array specifies a layer and the value of the + * integer for that element is the number of neurons in that layer + * @param learningRate the learning rate for the network. + * @param activationFunction the activation function to use for all neurons in the network. * @param threadExecutor executor to use for executing tasks. * @since 2.0 */ @@ -53,6 +57,10 @@ public final class FullyConnectedFeedforwardBrain<IN extends InputBackpropNeuron * Default constructor initializes a default threadExecutor based on the number * of processors. * + * @param neuronsPerLayer an array of integers, each element in the array specifies a layer and the value of the + * integer for that element is the number of neurons in that layer + * @param learningRate the learning rate for the network. + * @param activationFunction the activation function to use for all neurons in the network. * @since 2.0 */ public FullyConnectedFeedforwardBrain(final int[] neuronsPerLayer, final double learningRate, final ActivationFunction activationFunction) diff --git a/src/main/java/com/syncleus/dann/neural/som/SimpleSomNeuron.java b/src/main/java/com/syncleus/dann/neural/som/SimpleSomNeuron.java index 6ec5f27f..bc0beba8 100644 --- a/src/main/java/com/syncleus/dann/neural/som/SimpleSomNeuron.java +++ b/src/main/java/com/syncleus/dann/neural/som/SimpleSomNeuron.java @@ -42,6 +42,7 @@ public class SimpleSomNeuron extends AbstractNeuron implements SomOutputNeuron /** * Creates a default SimpleSomNeuron. * + * @param brain The brain which contains this neuron. * @since 2.0 */ public SimpleSomNeuron(final Brain brain) diff --git a/src/main/java/com/syncleus/dann/xml/XmlSerializable.java b/src/main/java/com/syncleus/dann/xml/XmlSerializable.java index bcb2274e..9784eb5f 100644 --- a/src/main/java/com/syncleus/dann/xml/XmlSerializable.java +++ b/src/main/java/com/syncleus/dann/xml/XmlSerializable.java @@ -22,18 +22,26 @@ public interface XmlSerializable<T, N> { /** * Write stand alone element, including all instances. + * + * @return returns a serialized XML version of the object */ T toXml(); /** * Write nested element assuming recurring instances of components are * already named. + * + * @param namer a class responsible for naming repeated occurances of the same object + * @return returns a serialized XML version of the object */ T toXml(Namer<N> namer); /** * Write nested element assuming recurring instances of components are * already named, use preexisting XML objects. + * + * @param jaxbObject The jaxbObject that will hold the serialization + * @param namer a class responsible for naming repeated occurances of the same object */ void toXml(T jaxbObject, Namer<N> namer); } -- GitLab