28 m_num_vectors = num_vecs;
29 m_num_features = num_feats;
44 REQUIRE(feats.
num_cols == feat_length*num_vecs,
"The number of columns of feats "
45 "must be equal to feat_length times num_vecs\n");
76 if ( num < 0 || num >= get_num_vectors() )
78 SG_ERROR(
"The index of the feature vector to get must be between "
79 "0 and %d (get_num_vectors()-1)\n", get_num_vectors()-1);
82 return m_features[num];
90 if ( num < 0 || num >= get_num_vectors() )
92 SG_ERROR(
"The index of the feature vector to get must be between "
93 "0 and %d (get_num_vectors()-1)\n", get_num_vectors()-1);
97 int32_t num_cols = m_features[num].num_cols;
98 int32_t num_rows = m_features[num].num_rows;
100 if ( col < 0 || col >= num_cols )
102 SG_ERROR(
"The index of the column to get must be between "
103 "0 and %d (#columns of the feature vector)\n", num_cols);
106 if ( out.
vlen < get_num_features() )
108 SG_ERROR(
"The vector out must have space to hold at least "
109 "%d (get_num_features()) elements\n", get_num_features());
112 int32_t start = col*num_rows;
113 for ( int32_t i = 0 ; i < get_num_features(); ++i )
115 out[i] = m_features[num][start + i];
123 if ( num < 0 || num >= get_num_vectors() )
125 SG_ERROR(
"The index of the feature vector to set must be between "
126 "0 and %d (get_num_vectors()-1)\n", get_num_vectors()-1);
129 if ( get_num_features() != 0 && vec.
num_rows != get_num_features() )
131 SG_ERROR(
"The feature vector to set must have the same features "
132 "as the rest of the MatrixFeatures, %d "
133 "(get_num_features())\n", get_num_features());
136 m_features.set_matrix(num, vec);
142 m_features = features;
144 m_num_features = num_feats;
149 SG_ADD(&m_num_vectors,
"m_num_vectors",
"Number of feature vectors",
151 SG_ADD(&m_num_features,
"m_num_features",
162 template<
class ST >
void CMatrixFeatures< ST >::cleanup()
164 m_features = SGMatrixList< ST >();
172 "base_features must be of dynamic type CMatrixFeatures\n")