/*
 * HiddenLayer.hpp
 *
 *  Created on: 21.09.2014
 *      Author: jens
 */

#ifndef HIDDENLAYER_HPP_
#define HIDDENLAYER_HPP_

#include "Layer.hpp"
#include <cmath>

class HiddenLayer : public Layer
{
public:
	HiddenLayer(uint32_t numUnits = 0, const VectorXd *pStatesInit = nullptr)
	: Layer(numUnits, pStatesInit)
	{
	}

	virtual ~HiddenLayer()
	{
	}

	double getEnergy(const Weights &weights)
	{
		double energy;

		energy = -((Weights&)weights).hiddenBias().transpose() * states();

		return energy;
	}

private:
	double accum(Layer &layer, Weights &weights, uint32_t index)
	{
		double sum = ((Weights&)weights).hiddenBias()[index];

		sum += layer.states().transpose() * ((Weights&)weights).weights().col(index);

		return sum;
	}
};

#endif /* HIDDENLAYER_HPP_ */
