MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
ActivationFunction.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/libraries/libann/ActivationFunction.h,v 1.11 2017/01/12 14:43:23 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 /*
32  * Copyright (C) 2008
33  *
34  * Mattia Mattaboni <mattaboni@aero.polimi.it>
35  */
36 
37 /* ACTIVATION FUNCTION */
38 #define W_F_NONE (0x00U)
39 #define W_F_TEXT (0x01U)
40 #define W_F_BIN (0x02U)
41 /* activation interface */
42 typedef int (*w_init_f)(void **);
43 typedef int (*w_destroy_f)(void *);
44 typedef int (*w_read_f)(void *, FILE *fd, unsigned flags);
45 typedef int (*w_write_f)(void *, FILE *fd, unsigned flags);
46 typedef int (*w_eval_f)(void *, double, int, double *);
47 
48 /* tanh activation function */
49 typedef struct w_tanh_t {
50  double alpha;
51  double beta;
52 } w_tanh_t;
53 
54 int w_tanh_init(void ** );
55 int w_tanh_destroy(void *);
56 int w_tanh_read(void * , FILE * , unsigned );
57 int w_tanh_write(void * , FILE * , unsigned );
58 int w_tanh_eval(void * , double, int, double *);
59 
60 typedef struct w_linear_t {
61  double m;
62  double q;
63 } w_linear_t;
64 
65 int w_linear_init(void ** );
66 int w_linear_destroy(void *);
67 int w_linear_read(void * , FILE * , unsigned );
68 int w_linear_write(void * , FILE * , unsigned );
69 int w_linear_eval(void * , double, int, double *);
struct w_linear_t w_linear_t
int(* w_destroy_f)(void *)
int w_tanh_destroy(void *)
int w_linear_init(void **)
int w_tanh_eval(void *, double, int, double *)
int w_tanh_init(void **)
int w_tanh_write(void *, FILE *, unsigned)
int(* w_eval_f)(void *, double, int, double *)
int(* w_init_f)(void **)
int w_linear_read(void *, FILE *, unsigned)
int w_tanh_read(void *, FILE *, unsigned)
int(* w_write_f)(void *, FILE *fd, unsigned flags)
int w_linear_write(void *, FILE *, unsigned)
int w_linear_eval(void *, double, int, double *)
struct w_tanh_t w_tanh_t
int w_linear_destroy(void *)
int(* w_read_f)(void *, FILE *fd, unsigned flags)