<commit_before>/*
 * Neuron.h
 *
 *  Created on: May 12, 2016
 *      Author: marija
 */

#ifndef NEURON_H_
#define NEURON_H_
#include <map>
#include <vector>
#include <sstream>

struct Edge_key {
	Edge_key(int l=0, int i=0, int o=0): layer{l}, in{i}, out{o}{}
	int layer;
	int in;
	int out;
	bool operator<(const Edge_key& key) const{
		std::stringstream ss1{};
		std::stringstream ss2{};
		ss1<<layer<< " " <<in<< " " << out;
		ss2<<key.layer<< " " <<key.in<< " " << key.out;
		return (ss1.str() < ss2.str());
	}

};


class Neuron {
public:
	Neuron(){}
	void add_in_edge(double e, const Edge_key & k) {edges_in[k] = e;}
	void add_out_edge(double e , const Edge_key & k) {edges_out[k] = e;}
	void set_out(double o) {out = o;}
	double get_out() {return out;}
	double & in_edges_weights(const Edge_key & k) {return edges_in[k];}
	std::vector<Edge_key> in_edges_keys();
	double & out_edges_weights(const Edge_key & k)  {return edges_out[k];}
	std::vector<Edge_key> out_edges_keys();
	double & in_edges_weights(int l, int i, int o) {return edges_in[Edge_key{l,i,o}];}
	double & out_edges_weights(int l, int i, int o)  {return edges_out[Edge_key{l,i,o}];}<commit_msg>Edge_key potimization, compare string precompute.<commit_after>/*
 * Neuron.h
 *
 *  Created on: May 12, 2016
 *      Author: marija
 */

#ifndef NEURON_H_
#define NEURON_H_
#include <map>
#include <vector>
#include <sstream>

struct Edge_key {
	Edge_key(int l = 0, int i = 0, int o = 0) : layer{ l }, in{ i }, out{ o } {
		std::stringstream ss1{};
		ss1<<layer<< " " <<in<< " " << out;
		desc = ss1.str();
	}
	int layer;
	int in;
	int out;
	
	bool operator<(const Edge_key& key) const{
		return desc < key.desc;
	}
private:
	std::string desc;

};


class Neuron {
public:
	Neuron(){}
	void add_in_edge(double e, const Edge_key & k) {edges_in[k] = e;}
	void add_out_edge(double e , const Edge_key & k) {edges_out[k] = e;}
	void set_out(double o) {out = o;}
	double get_out() {return out;}
	double & in_edges_weights(const Edge_key & k) {return edges_in[k];}
	std::vector<Edge_key> in_edges_keys();
	double & out_edges_weights(const Edge_key & k)  {return edges_out[k];}
	std::vector<Edge_key> out_edges_keys();
	double & in_edges_weights(int l, int i, int o) {return edges_in[Edge_key{l,i,o}];}
	double & out_edges_weights(int l, int i, int o)  {return edges_out[Edge_key{l,i,o}];}
{'fraction_non_alphanumeric': 0.167590618336887, 'fraction_numerical': 0.011513859275053304, 'mean_word_length': 4.6124401913875595, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5158051', 'n_tokens_mistral': 999, 'n_tokens_neox': 961, 'n_words': 243}