nodes_value_containers.hpp 1.29 KB
Newer Older
Thomas Purcell's avatar
Thomas Purcell committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef NODE_VALEU_ARR
#define NODE_VALEU_ARR

#include <memory>
#include <vector>

#include<utils/enum.hpp>

namespace node_value_arrs
{
    extern int N_SAMPLES;
    extern int N_STORE_FEATURES;
    extern int N_RUNGS_STORED;

15
16
17
    extern std::unique_ptr<int[]> TEMP_STORAGE_REG;
    extern std::unique_ptr<double[]> VALUES_ARR;
    extern std::unique_ptr<double[]> TEMP_STORAGE_ARR;
Thomas Purcell's avatar
Thomas Purcell committed
18

19
    int get_number_new_features(std::string new_op, int n_current_features);
Thomas Purcell's avatar
Thomas Purcell committed
20

21
    int get_max_number_features(std::vector<std::string> allowed_operators, int n_dims, int n_feats);
Thomas Purcell's avatar
Thomas Purcell committed
22

23
    void setup_values_arr(int n_samples, int n_dims, int n_primary_feat, std::vector<std::string> allowed_operators);
Thomas Purcell's avatar
Thomas Purcell committed
24

25
    inline int& temp_storage_reg(int ind, int offset = 0){return TEMP_STORAGE_REG[(ind % N_STORE_FEATURES) + offset * N_STORE_FEATURES];}
Thomas Purcell's avatar
Thomas Purcell committed
26

27
28
29
30
31
32
33
34
35
36
37
    inline double* access_value_arr(int feature_ind){return VALUES_ARR.get() + feature_ind*N_SAMPLES;}

    inline double* access_temp_storage(int slot){return TEMP_STORAGE_ARR.get() + slot*N_SAMPLES;}

    inline double* get_value_ptr(int ind, int offset = 0)
    {
        if(ind < N_STORE_FEATURES)
            return  access_value_arr(ind);
        temp_storage_reg(ind, offset) = ind;
        return access_temp_storage((ind % N_STORE_FEATURES) + offset * N_STORE_FEATURES);
    }
Thomas Purcell's avatar
Thomas Purcell committed
38
39
40
}

#endif