1 /* 2 * PNode.h 3 * 4 * Created on: 8 Apr 2013 5 * Author: s0965328 6 */ 7 8 #ifndef PNODE_H_ 9 #define PNODE_H_ 10 11 #include "Node.h" 12 namespace AutoDiff { 13 14 using namespace std; 15 class PNode: public Node { 16 public: 17 PNode(double value); 18 virtual ~PNode(); 19 void collect_vnodes(boost::unordered_set<Node*>& nodes,unsigned int& total); 20 void eval_function(); 21 void grad_reverse_0(); 22 void grad_reverse_1_init_adj(); 23 void grad_reverse_1(); 24 void update_adj(double& v); 25 void hess_forward(unsigned int len,double** ret_vec); 26 unsigned int hess_reverse_0(); 27 void hess_reverse_0_get_values(unsigned int i,double& x,double& x_bar,double& w,double& w_bar); 28 void hess_reverse_1(unsigned int i); 29 void hess_reverse_1_init_x_bar(unsigned int); 30 void update_x_bar(unsigned int, double); 31 void update_w_bar(unsigned int, double); 32 void hess_reverse_1_get_xw(unsigned int, double&,double&); 33 void hess_reverse_get_x(unsigned int,double& x); 34 35 void nonlinearEdges(EdgeSet&); 36 37 void inorder_visit(int level,ostream& oss); 38 string toString(int level); 39 TYPE getType(); 40 41 double pval; 42 43 }; 44 45 } // end namespace foo 46 47 #endif /* PNODE_H_ */ 48