summaryrefslogtreecommitdiff
path: root/src/slopestd.h
blob: 5b556ea340aef9773ff94a6838f9de8389a44287 (plain)
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
#ifndef NEURAL_SLOPE_STD_H
#define NEURAL_SLOPE_STD_H

#include <math.h>

#include "neural/slope.h"

namespace Neural
{
	template<typename sigtype>
	sigtype tpltanh( sigtype sInput );

	template<>
	float tpltanh<float>( float sInput );
	template<>
	double tpltanh<double>( double sInput );
	template<>
	long double tpltanh<long double>( long double sInput );

	template<typename sigtype>
	class SlopeStd : public Slope<sigtype>
	{
	public:
		SlopeStd( sigtype sSlope=1.0 ) :
			sSlope( sSlope )
		{
		}

		virtual ~SlopeStd()
		{
		}

		virtual sigtype operator()( sigtype sInput )
		{
			return tpltanh<sigtype>(2.0*sSlope*sInput);
		}

	private:
		sigtype sSlope;
	};
};

#endif