#ifndef LAYER_HPP
#define LAYER_HPP

#include "debug.hpp"
#include "vector.hpp"
#include <cmath>

namespace Layer{
  class Layer{
  public:
    size_t n_in,n_out;
    Vector x_in;
    Vector x_out;
    Vector delta;
    string name;
  public:
    Layer(size_t n);
    Layer(size_t n_in,size_t n_out);
    ~Layer();
    size_t get_input_size() const;
    size_t get_output_size() const;
    Vector get_output() const;
    virtual Vector feed_forward(Vector x)=0;
    virtual void init_nabla()=0;
    virtual Vector back_propagation(Vector d)=0;
    virtual void update(Real eta)=0;
  };


  inline
  Layer::Layer(size_t n){
    n_in=n;
    n_out=n;
    x_out=init_vector(n);
    delta=init_vector(n);
  }

  inline
  Layer::Layer(size_t n_in_,size_t n_out_){
    n_in=n_in_;
    n_out=n_out_;
    x_out=init_vector(n_out);
    delta=init_vector(n_in);
  }

  inline
  Layer::~Layer(){
    delete_vector(x_out);
    delete_vector(delta);
  }

  inline size_t
  Layer::get_input_size() const{
    return n_in;
  }

  inline size_t
  Layer::get_output_size() const{
    return n_out;
  }

  inline Vector
  Layer::get_output() const{
    return x_out;
  }
}


#endif
