inline void ActFunc::tanh(MatD& x){ x = x.array().tanh(); }
//f'(x) = f(x)(1-f(x)) inline MatD ActFunc::logisticPrime(const MatD& x){ return x.array()*(1.0-x.array()); }
inline double cosDis(const MatD& a, const MatD& b){ return (a.array()*b.array()).sum()/(a.norm()*b.norm()); //return a.col(0).dot(b.col(0))/(a.norm()*b.norm()); }
//f'(x) = 1-(f(x))^2 inline MatD ActFunc::tanhPrime(const MatD& x){ return 1.0-x.array().square(); }