mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Added more helper methods to math.
This commit is contained in:
parent
67b9aa6d0a
commit
11e474ae3b
@ -323,6 +323,26 @@ public:
|
||||
|
||||
return hf;
|
||||
}
|
||||
|
||||
static _ALWAYS_INLINE_ double sigmoid(const double x) {
|
||||
return 1 / (1 + exp(-x));
|
||||
}
|
||||
|
||||
static _ALWAYS_INLINE_ double sigmoid_derived(const double x) {
|
||||
return sigmoid(x) * (1 - sigmoid(x));
|
||||
}
|
||||
|
||||
static _ALWAYS_INLINE_ double tanh_derived(const double x) {
|
||||
return 1 - pow(tanh(x), 2);
|
||||
}
|
||||
|
||||
static _ALWAYS_INLINE_ double linear(const double x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
static _ALWAYS_INLINE_ double linear_derived(const double x) {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef ABS
|
||||
|
Loading…
Reference in New Issue
Block a user