Feat C++ API
A feature engineering automation tool
n_geq.cc
Go to the documentation of this file.
1 /* FEAT
2 copyright 2017 William La Cava
3 license: GNU/GPL v3
4 */
5 
6 #include "n_geq.h"
7 
8 namespace FT{
9 
10  namespace Pop{
11  namespace Op{
13  {
14  name = ">=";
15  otype = 'b';
16  arity['f'] = 2;
17  complexity = 2;
18  }
19 
20  #ifndef USE_CUDA
22  void NodeGEQ::evaluate(const Data& data, State& state)
23  {
24  ArrayXf x1 = state.pop<float>();
25  ArrayXf x2 = state.pop<float>();
26  state.push<bool>(x1 >= x2);
27  }
28  #else
29  void NodeGEQ::evaluate(const Data& data, State& state)
30  {
31  GPU_GEQ(state.dev_f, state.dev_b, state.idx['f'], state.idx[otype], state.N);
32  }
33  #endif
34 
36  void NodeGEQ::eval_eqn(State& state)
37  {
38  state.push<bool>("(" + state.popStr<float>() + ">=" + state.popStr<float>() + ")");
39  }
40 
41  NodeGEQ* NodeGEQ::clone_impl() const { return new NodeGEQ(*this); }
42 
43  NodeGEQ* NodeGEQ::rnd_clone_impl() const { return new NodeGEQ(); }
44  }
45  }
46 }
data holding X, y, and Z data
Definition: data.h:42
void evaluate(const Data &data, State &state)
Evaluates the node and updates the state states.
Definition: n_geq.cc:22
NodeGEQ * clone_impl() const override
Definition: n_geq.cc:41
void eval_eqn(State &state)
Evaluates the node symbolically.
Definition: n_geq.cc:36
NodeGEQ * rnd_clone_impl() const override
Definition: n_geq.cc:43
string name
node type
Definition: node.h:56
std::map< char, unsigned int > arity
arity of the operator
Definition: node.h:59
char otype
output type
Definition: node.h:58
int complexity
complexity of node
Definition: node.h:60
void GPU_GEQ(float *xf, bool *xb, size_t idxf, size_t idxb, size_t N)
main Feat namespace
Definition: data.cc:13
contains various types of State actually used by feat
Definition: state.h:102
string popStr()
Definition: state.h:143
Eigen::Array< T, Eigen::Dynamic, 1 > pop()
Definition: state.h:128
void push(Eigen::Array< T, Eigen::Dynamic, 1 > value)
Definition: state.h:123