-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathneural_network_potential.h
More file actions
58 lines (39 loc) · 916 Bytes
/
neural_network_potential.h
File metadata and controls
58 lines (39 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Created by Masayoshi Ogura on 2018/06/~~.
//
#ifndef INCLUDED_NNP_H_
#define INCLUDED_NNP_H_
#define EIGEN_USE_MKL_ALL
#define EIGEN_NO_DEBUG
#define EIGEN_MPL2_ONLY
#include <Eigen/Core>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace Eigen;
class Layer {
private:
void set_activation(string);
typedef void (Layer::*FuncPtr)(VectorXd &, VectorXd &);
FuncPtr activation;
void tanh(VectorXd &, VectorXd &);
void elu(VectorXd &, VectorXd &);
void sigmoid(VectorXd &, VectorXd &);
void identity(VectorXd &, VectorXd &);
public:
MatrixXd weight;
VectorXd bias;
Layer(int, int, vector<double> &, vector<double> &, string);
~Layer();
void feedforward(VectorXd &, VectorXd &);
};
class NNP {
public:
int depth;
vector<Layer> layers;
NNP(int);
~NNP();
void feedforward(VectorXd, VectorXd &, int, double &);
};
#endif