/// <summary> /// Allowes indexed access to the data. /// </summary> /// <param name="x">The index.</param> /// <returns>The value at the specified index.</returns> public double this[int x] { get { return(BiPolarUtil.Bipolar2double(this.data[x])); } set { this.data[x] = BiPolarUtil.Double2bipolar(value); } }
/// <summary> /// Note: for Hopfield networks, you will usually want to call the "run" /// method to compute the output. /// This method can be used to copy the input data to the current state. A /// single iteration is then run, and the new current state is returned. /// </summary> /// /// <param name="input">The input pattern.</param> /// <returns>The new current state.</returns> public override sealed IMLData Compute(IMLData input) { var result = new BiPolarMLData(input.Count); input.CopyTo(CurrentState.Data, 0, input.Count); Run(); for (int i = 0; i < CurrentState.Count; i++) { result.SetBoolean(i, BiPolarUtil.Double2bipolar(CurrentState[i])); } EngineArray.ArrayCopy(CurrentState.Data, result.Data); return(result); }