/
neuron.h
77 lines (70 loc) · 3 KB
/
neuron.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/******************************************************************************/
/* */
/* Title : Neuron Class - header file */
/* Program Name : neuron.h */
/* */
/* Detail : Header file of Neuron Class */
/* Date : 2015/05/28 */
/* Author : Akihiro Kashiwagi */
/* e-mail : a-kashiwagi@mippi-mail.com */
/* */
/* Replace -------------------------------------------------------------------*/
/* */
/* Date : */
/* Author : */
/* Deteil : */
/* */
/*-------+---------+---------+---------+---------+---------+---------+--------*/
/*3456789012345678901234567890123456789012345678901234567890123456789012345678*/
/******************************************************************************/
#ifndef _NEURON_H_DEFINED
#include <stdio.h>
#include <malloc.h>
/* Neuron Structure */
typedef struct neuron {
double u;
/* Value of internal */
double *w;
/* Weight */
double a;
/* Bias for visible unit */
double da;
/* Delta of bias for v unit */
double b;
/* Bias for hidden unit */
double db;
/* Delta of bias for h unit */
long w_len;
/* Length of weight (Links) */
double bias;
/* Bias */
double **wf;
/* Weight for front */
double **dwf;
/* Delta of weight for front */
long wf_len;
/* Length of front weight */
double **wb;
/* Weight for back */
double **dwb;
/* Delta of weight for back */
long wb_len;
/* Length of back weight */
int (*init )( struct neuron *n, long len);
/* Pointer for init() */
int (*alloc_w)( struct neuron *n );
/* Pointer for alloc_w() */
int (*free )( struct neuron *n );
/* Pointer for free() */
int (*calc )( struct neuron *n );
/* Pointer for calc() */
int (*learn )( struct neuron *n );
/* Pointer for learn() */
} NEURON_T;
int init_neuron( NEURON_T *n, long len );
int alloc_neuron( NEURON_T *n );
int free_neuron( NEURON_T *n );
NEURON_T *create_neuron( long num, long links );
double **create_synapse( NEURON_T *ni, long i, NEURON_T *nj, long j );
#define _NEURON_H_DEFINED
#endif