1 #ifndef RN_FEATURES_HXX
2 #define RN_FEATURES_HXX
14 return shape()[index];
16 double & operator() (
int i,
int j) = 0;
20 class CompositFeatures :
public FeatureBase
27 ArrayVector<FeatureBase > sub_feats;
28 void add(FeatureBase & feat)
30 if(feat.shape(0) != this->shape(0))
31 throw std::runtime_error(
"Wrong Number Of samples");
33 sub_feats.push_back(feat);
34 for(
int ii = 0; ii < feat.shape(1); ++ii)
35 ext2int.push_back(Shp(sub_feats.size()-1,
46 double & operator() (
int i,
int j)
48 return sub_feats[ext2int[j][0]](i, ext2int[j][1]);
52 template<
int N,
class T,
class C>
53 class NeighborFeatures :
public FeatureBase
56 typedef typename MultiArrayShape<N>::type Shp;
57 MultiArrayView<N, T, C> raw_data;
66 double & operator() (
int i,
int j)
68 return raw_data(raw_data.scanOrderIndexToCoordinate(i) + feat_coos(j));
70 NeighborFeatures(MultiArrayView<N, T, C> & in, MultiArrayView<2, int>
const & coos)
73 for(
int ii = 0; ii < coos.shape(0); ++ii)
74 feat_coos.push_back(Shp());
75 for(
int jj = 0; jj < coos.shape(1); ++jj)
76 feat_coos.back()[jj] = coos(ii, jj);
82 class BindFeatureColumn :
public FeatureBase
84 typedef typename MultiArrayShape<N>::type Shp;
86 FeatureBase & underlying;
93 double & operator() (
int i,
int j)
95 return underlying(i, index);
97 double & operator[](
int i)
99 return underlying(i, index);
102 BindFeatureColumn(FeaetureBase & in,
int index_)
103 : index(index_), underlying(in)
111 return BindFeatureColumn(in, ii);
MultiArrayView< 2, T, C > columnVector(MultiArrayView< 2, T, C > const &m, MultiArrayIndex d)
Definition: matrix.hxx:727
void add(FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r, FixedPoint< IntBits3, FracBits3 > &result)
addition with enforced result type.
Definition: fixedpoint.hxx:561
TinyVector< MultiArrayIndex, N > type
Definition: multi_shape.hxx:272