#pragma once

#include "./core/omp_config.h"

#include "./utils/vector.h"
#include "./utils/matrix.h"

#include "./numerics/vecmean.h"

namespace neural_networks{

	template <typename Td, typename Ti>
	struct Loss{

			utils::Vector<Td> sample_losses;
			Td data_loss;

			virtual utils::Vector<Td> forward(const utils::Matrix<Td>& output, const utils::Matrix<Ti>& y) = 0;

			Td calculate(const utils::Matrix<Td>& output, const utils::Matrix<Ti>& y){
				
				// Calculate sample losses
				sample_losses = forward(output, y);

				// Calculate mean loss
				data_loss = numerics::vecmean(sample_losses);
				return data_loss;

			}
	};

} // end namespace neural_networks