public function testClear()
 {
     $d = [1, 1];
     $data = new BiPolarNeuralData(2);
     $data->setDataFromArray($d);
     $data->clear();
     $this->assertEquals(-1, $data->getData(0), 0.5);
     $data->setData(0, true);
     $this->assertEquals(true, $data->getBoolean(0));
 }
 /**
  *
  * @return MLData A cloned copy of this object.
  */
 public function __clone()
 {
     $result = new BiPolarNeuralData($this->size());
     $result->setDataFromArray($this->data);
     return $result;
 }
 /**
  * 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.
  *
  * @param
  *        	MLData input
  *        	The input pattern.
  * @return MLData The new current state.
  */
 public function compute(MLData $input)
 {
     $result = new BiPolarNeuralData($input->size());
     EngineArray\arrayCopy($input->getData(), $this->getCurrentState()->getData());
     $this->run();
     for ($i = 0; $i < $this->getCurrentState()->size(); ++$i) {
         $result->setData($i, BiPolarUtil\double2bipolar($this->getCurrentState()->getData($i)));
     }
     EngineArray\arrayCopy($this->getCurrentState()->getData(), $result->getData());
     return $result;
 }