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

#ifndef VISIBLELAYER_HPP_
#define VISIBLELAYER_HPP_

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

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

	virtual ~VisibleLayer()
	{
	}

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

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

		return energy;
	}

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

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

		return sum;
	}
};

#endif /* VISIBLELAYER_HPP_ */
