This forum has been archived. All content is frozen. Please use KDE Discuss instead.

way to add tanh function to Eigen

Tags: None
(comma "," separated)
leephilip
Registered Member
Posts
1
Karma
0

way to add tanh function to Eigen

Sun Nov 24, 2013 12:25 am
Hi, I'm recently writing a neural network, but I didn't find tanh function in Eigen. I did some trying and found a way to add tanh to Eigen. This works because Eigen uses std::tan/sin/cos .etc to compute each coefficient. You can copy the definition of tan function and change them to tanh.

The following files should be modified.
Code: Select all
    /-Core
        |-Assign_MKL.h
        |-Functors.h
        |-GenericPacketMath.h     two places: HasTanh and its deinition
        |-MathFunctions.h
         /-Utils
            |-ForwardDeclarations.h
    /-Plugins
      |-ArrayCwiseUnaryOps.h


If you are not sure what to modify you can search for tan or cos in all files in Eigen folder and see which files are affected. I'm not sure if this will work robustly, but it works for my case at least.

Cheers,

Phil


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]