RLPark 1.0.0
Reinforcement Learning Framework in Java

Connections.java

Go to the documentation of this file.
00001 package rlpark.plugin.rltoys.algorithms.representations.ltu.units;
00002 
00003 public class Connections {
00004   final public int[] indexes;
00005   final public byte[] weights;
00006   public int nbActive = 0;
00007 
00008   public Connections(int length) {
00009     indexes = new int[length];
00010     weights = new byte[length];
00011   }
00012 
00013   public void setEntry(int index, byte weight) {
00014     indexes[nbActive] = index;
00015     weights[nbActive] = weight;
00016     nbActive++;
00017   }
00018 
00019   public double dotProduct(double[] inputVector) {
00020     double result = 0;
00021     for (int i = 0; i < indexes.length; i++)
00022       result += inputVector[indexes[i]] * weights[i];
00023     return result;
00024   }
00025 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark