Neuron: neural networks


lelm.h
Go to the documentation of this file.
1
2#ifndef NEUR_LELM_H
3#define NEUR_LELM_H
4
5
6
7// LIENS ELEMENTAIRES
8
20template <class T> class lelm
21{
22 public:
23
26
27 lelm(int ori=0,T wgt=0) { _or=ori; _w=wgt; }
29 ~lelm() { }
31
34
35 lelm<T> & operator =(const lelm<T> & le);
36 lelm<T> & operator +(const lelm<T> & le);
37 lelm<T> & operator -(const lelm<T> & le);
38 lelm<T> & operator *(const lelm<T> & le);
39 lelm<T> & operator /(const lelm<T> & le);
40 lelm<T> & operator ^(const lelm<T> & le);
46 inline int operator ==(const lelm<T> & le) const;
48 inline int operator !=(const lelm<T> & le) const;
50 inline int operator <(const lelm<T> & le) const;
52 inline int operator >(const lelm<T> & le) const;
54 inline int operator <=(const lelm<T> & le) const;
56 inline int operator >=(const lelm<T> & le) const;
58
61
62 void set(int ori, T wgt) { _or=ori; _w=wgt; }
64 void set_w(T wgt) { _w=wgt; }
66 void set_or(int ori) { _or=ori; }
68
71
72 int org() const { return(_or); }
74 T w() const { return(_w); }
76
79
80 void aff() const;
82
83
84 protected:
85
87 int _or;
89 T _w;
90};
91
92
93// inline functions
94
95
96template<class T> inline int lelm<T>::operator == (const lelm<T> & le) const
97{
98 return( (_or==le._or) && (_w==le._w) );
99}
100
101
102template<class T> inline int lelm<T>::operator != (const lelm<T> & le) const
103{
104 return( (_or!=le._or) || (_w!=le._w) );
105}
106
107
108template<class T> inline int lelm<T>::operator < (const lelm<T> & le) const
109{
110 return( _w < le._w );
111}
112
113
114template<class T> inline int lelm<T>::operator > (const lelm<T> & le) const
115{
116 return( _w > le._w );
117}
118
119
120template<class T> inline int lelm<T>::operator <= (const lelm<T> & le) const
121{
122 return( _w <= le._w );
123}
124
125
126template<class T> inline int lelm<T>::operator >= (const lelm<T> & le) const
127{
128 return( _w >= le._w );
129}
130
131
132
133#endif
134
135
lelm< T > & operator^(const lelm< T > &le)
int operator!=(const lelm< T > &le) const
Definition lelm.h:102
int operator==(const lelm< T > &le) const
Definition lelm.h:96
T _w
Champ poids.
Definition lelm.h:89
lelm< T > & operator-=(const lelm< T > &le)
lelm< T > & operator/=(const lelm< T > &le)
lelm< T > & operator-(const lelm< T > &le)
void set_or(int ori)
Fixe l'origine.
Definition lelm.h:66
void set_w(T wgt)
Fixe le poids.
Definition lelm.h:64
int operator<(const lelm< T > &le) const
Comparaison des poids.
Definition lelm.h:108
int org() const
Origine.
Definition lelm.h:72
int _or
Champ origine de la connexion.
Definition lelm.h:87
lelm< T > & operator/(const lelm< T > &le)
lelm< T > & operator*(const lelm< T > &le)
int operator>(const lelm< T > &le) const
Definition lelm.h:114
void aff() const
Affichage des caractéristiques de la liaison.
int operator>=(const lelm< T > &le) const
Definition lelm.h:126
lelm< T > & operator*=(const lelm< T > &le)
lelm< T > & operator+(const lelm< T > &le)
int operator<=(const lelm< T > &le) const
Definition lelm.h:120
void set(int ori, T wgt)
Fixe l'origine et le poids en même temps.
Definition lelm.h:62
lelm(int ori=0, T wgt=0)
Constructeur.
Definition lelm.h:27
lelm< T > & operator=(const lelm< T > &le)
lelm< T > & operator+=(const lelm< T > &le)
~lelm()
Destructeur.
Definition lelm.h:29
T w() const
Poids.
Definition lelm.h:74