Skip to content

Commit 44b15b8

Browse files
author
Martin Klang
committed
Merge branch 'master' into develop
2 parents 0c925be + 5934bd8 commit 44b15b8

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

LibSource/FloatArray.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,15 @@ void FloatArray::ramp(float from, float to){
507507
}
508508
}
509509

510+
void FloatArray::tanh(FloatArray destination){
511+
for(size_t i=0; i<size; i++)
512+
destination[i] = tanhf(data[i]);
513+
}
514+
515+
void FloatArray::tanh(){
516+
tanh(*this);
517+
}
518+
510519
FloatArray FloatArray::create(int size){
511520
FloatArray fa(new float[size], size);
512521
fa.clear();

LibSource/FloatArray.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,16 @@ class FloatArray {
473473
* Create a linear ramp from one value to another across all values in the Float
474474
*/
475475
void ramp(float from, float to);
476+
477+
/**
478+
* Apply tanh to each element in the array
479+
*/
480+
void tanh(FloatArray destination);
481+
482+
/**
483+
* In-place tanh
484+
*/
485+
void tanh();
476486

477487
/**
478488
* Creates a new FloatArray.

0 commit comments

Comments
 (0)