Feat C++ API
A feature engineering automation tool
n_float.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_float.h"
6 
7 namespace FT{
8 
9  namespace Pop{
10  namespace Op{
11  template <>
13  {
14  name = "b2f";
15  otype = 'f';
16  arity['b'] = 1;
17  complexity = 1;
18  }
19 
20  template <>
22  {
23  name = "c2f";
24  otype = 'f';
25  arity['c'] = 1;
26  complexity = 1;
27  }
28 
29  #ifndef USE_CUDA
31  template <class T>
32  void NodeFloat<T>::evaluate(const Data& data, State& state)
33  {
34  state.push<float>(state.pop<T>().template cast<float>());
35  }
36  #else
37  template <class T>
38  void NodeFloat<T>::evaluate(const Data& data, State& state)
39  {
40  if(arity['b'])
41  GPU_Float(state.dev_f, state.dev_b, state.idx[otype], state.idx['b'], state.N);
42  else
43  GPU_Float(state.dev_f, state.dev_c, state.idx[otype], state.idx['c'], state.N);
44  }
45  #endif
46 
48  template <class T>
50  {
51  state.push<float>("float(" + state.popStr<T>() + ")");
52  }
53 
54  template <class T>
55  NodeFloat<T>* NodeFloat<T>::clone_impl() const { return new NodeFloat<T>(*this); }
56 
57  template <class T>
58  NodeFloat<T>* NodeFloat<T>::rnd_clone_impl() const { return new NodeFloat<T>(*this); }
59  }
60  }
61 }
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_float.cc:32
NodeFloat * clone_impl() const override
Definition: n_float.cc:55
void eval_eqn(State &state)
Evaluates the node symbolically.
Definition: n_float.cc:49
NodeFloat * rnd_clone_impl() const override
Definition: n_float.cc:58
void GPU_Float(float *x, bool *y, 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