1 /***************************************************************************** 2 FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/kernel/sources/func_mac.h,v $ 3 SHORTNAME : 4 SNNS VERSION : 4.2 5 6 PURPOSE : SNNS-Kernel: Macros for transfer functions 7 NOTES : 8 9 AUTHOR : Niels Mache 10 DATE : 21.06.90 11 12 CHANGED BY : Sven Doering 13 RCS VERSION : $Revision: 2.7 $ 14 LAST CHANGE : $Date: 1998/02/25 15:26:12 $ 15 16 Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG 17 Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG 18 19 ******************************************************************************/ 20 #ifndef KR_FUNC_MACROS 21 #define KR_FUNC_MACROS 22 23 #define UNIT_PTR struct Unit * 24 #define SITE_PTR struct Site * 25 26 #define ACT_FUNC_DEFS register struct Link *__link_ptr; \ 27 register struct Site *__site_ptr; 28 29 #define SITE_FUNC_DEFS register struct Link *__link_ptr; 30 31 32 /*################################################# 33 34 GROUP: Link Macros 35 36 #################################################*/ 37 38 #define GET_FIRST_UNIT_LINK( u_ptr ) (__link_ptr = ( (u_ptr)->flags & UFLAG_DLINKS) ? \ 39 ( (struct Link *) (u_ptr)->sites) : (NULL) ) 40 41 #define GET_FIRST_SITE_LINK( s_ptr ) (__link_ptr = (s_ptr)->links) 42 43 #define GET_NEXT_LINK (__link_ptr = __link_ptr->next) 44 45 #define GET_WEIGHTED_OUTPUT ( (__link_ptr->weight) * (__link_ptr->to->Out.output) ) 46 47 #define GET_OUTPUT (__link_ptr->to->Out.output) 48 49 #define GET_WEIGHT (__link_ptr->weight) 50 51 #define GET_TACOMA_RADIUS (__link_ptr->value_a) 52 53 #define GET_TACOMA_COORD (__link_ptr->value_b) 54 55 #define LINK_FROM_INPUT_UNIT (IS_INPUT_UNIT(__link_ptr->to)) 56 57 /* calculate each component of the euclidic distance */ 58 #define GET_EUCLID_COMP ( ((__link_ptr->weight) - (__link_ptr->to->Out.output))*((__link_ptr->weight) - (__link_ptr->to->Out.output)) ) 59 60 61 /*################################################# 62 63 GROUP: Site Macros 64 65 #################################################*/ 66 67 #define GET_FIRST_SITE( u_ptr ) (__site_ptr = ( (u_ptr)->flags & UFLAG_SITES) ? \ 68 ( (u_ptr)->sites ) : (NULL) ) 69 70 #define GET_NEXT_SITE (__site_ptr = __site_ptr->next) 71 72 #define GET_SITE_NAME (__site_ptr->site_table->Entry.site_name->Entry.symbol) 73 74 #define GET_SITE_VALUE ( (*__site_ptr->site_table->site_func) (__site_ptr) ) 75 76 /* Future Application (in SNNS-Kernel V1.4 the sites don't have weights). 77 */ 78 #define GET_SITE_WEIGHT ((FlintType) 1) 79 80 81 /*################################################# 82 83 GROUP: Unit Macros 84 85 #################################################*/ 86 87 #define GET_UNIT_BIAS( u_ptr ) ((u_ptr)->bias) 88 #define GET_UNIT_ACT( u_ptr ) ((u_ptr)->act) 89 90 91 #endif 92