Feat C++ API
A feature engineering automation tool
n_leq.cc
Go to the documentation of this file.
1 /* FEAT
2 copyright 2017 William La Cava
3 license: GNU/GPL v3
4 */
5 #include "n_leq.h"
6 
7 namespace FT{
8 
9  namespace Pop{
10  namespace Op{
12  {
13  name = "<=";
14  otype = 'b';
15  arity['f'] = 2;
16  complexity = 2;
17  }
18 
19  #ifndef USE_CUDA
21  void NodeLEQ::evaluate(const Data& data, State& state)
22  {
23  ArrayXf x1 = state.pop<float>();
24  ArrayXf x2 = state.pop<float>();
25  state.push<bool>(x1 <= x2);
26  }
27  #else
28  void NodeLEQ::evaluate(const Data& data, State& state)
29  {
30  GPU_LEQ(state.dev_f, state.dev_b, state.idx['f'], state.idx[otype], state.N);
31  }
32  #endif
33 
35  void NodeLEQ::eval_eqn(State& state)
36  {
37  state.push<bool>("(" + state.popStr<float>() + "<=" + state.popStr<float>() + ")");
38  }
39 
40  NodeLEQ* NodeLEQ::clone_impl() const { return new NodeLEQ(*this); }
41 
42  NodeLEQ* NodeLEQ::rnd_clone_impl() const { return new NodeLEQ(); }
43  }
44  }
45 }
data holding X, y, and Z data
Definition: data.h:42
NodeLEQ * clone_impl() const override
Definition: n_leq.cc:40
void eval_eqn(State &state)
Evaluates the node symbolically.
Definition: n_leq.cc:35
void evaluate(const Data &data, State &state)
Evaluates the node and updates the state states.
Definition: n_leq.cc:21
NodeLEQ * rnd_clone_impl() const override
Definition: n_leq.cc:42
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_LEQ(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