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");
83 if ( num < 0 || num >= get_num_vectors() )
85 SG_ERROR(
"The index of the feature vector to get must be between "
86 "0 and %d (get_num_vectors()-1)\n", get_num_vectors()-1);
89 return m_features[num];
97 if ( num < 0 || num >= get_num_vectors() )
99 SG_ERROR(
"The index of the feature vector to get must be between "
100 "0 and %d (get_num_vectors()-1)\n", get_num_vectors()-1);
104 int32_t num_cols = m_features[num].num_cols;
105 int32_t num_rows = m_features[num].num_rows;
107 if ( col < 0 || col >= num_cols )
109 SG_ERROR(
"The index of the column to get must be between "
110 "0 and %d (#columns of the feature vector)\n", num_cols);
113 if ( out.
vlen < get_num_features() )
115 SG_ERROR(
"The vector out must have space to hold at least "
116 "%d (get_num_features()) elements\n", get_num_features());
119 int32_t start = col*num_rows;
120 for ( int32_t i = 0 ; i < get_num_features(); ++i )
122 out[i] = m_features[num][start + i];
130 if ( num < 0 || num >= get_num_vectors() )
132 SG_ERROR(
"The index of the feature vector to set must be between "
133 "0 and %d (get_num_vectors()-1)\n", get_num_vectors()-1);
136 if ( get_num_features() != 0 && vec.
num_rows != get_num_features() )
138 SG_ERROR(
"The feature vector to set must have the same features "
139 "as the rest of the MatrixFeatures, %d "
140 "(get_num_features())\n", get_num_features());
143 m_features[num] = vec;
149 m_features = features;
151 m_num_features = num_feats;
156 SG_ADD(&m_num_vectors,
"m_num_vectors",
"Number of feature vectors",
158 SG_ADD(&m_num_features,
"m_num_features",
167 template<
class ST >
void CMatrixFeatures< ST >::cleanup()
169 m_features = SGMatrixList< ST >();
174 template class CMatrixFeatures<bool>;
175 template class CMatrixFeatures<char>;
176 template class CMatrixFeatures<int8_t>;
177 template class CMatrixFeatures<uint8_t>;
178 template class CMatrixFeatures<int16_t>;
179 template class CMatrixFeatures<uint16_t>;
180 template class CMatrixFeatures<int32_t>;
181 template class CMatrixFeatures<uint32_t>;
182 template class CMatrixFeatures<int64_t>;
183 template class CMatrixFeatures<uint64_t>;
184 template class CMatrixFeatures<float32_t>;
185 template class CMatrixFeatures<float64_t>;
186 template class CMatrixFeatures<floatmax_t>;