Tapkee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
features.hpp
Go to the documentation of this file.
1 /* This software is distributed under BSD 3-clause license (see LICENSE file).
2  *
3  * Copyright (c) 2012-2013 Vladyslav Gorbatiuk
4  */
5 
6 #ifndef TAPKEE_FEATURES_H_
7 #define TAPKEE_FEATURES_H_
8 
9 /* Tapkee includes */
10 #include <tapkee/defines.hpp>
11  /* End of Tapkee includes */
12 
13 namespace tapkee
14 {
15 namespace tapkee_internal
16 {
17 
18 template<class RandomAccessIterator, class FeaturesCallback>
19 DenseMatrix dense_matrix_from_features(FeaturesCallback features,
20  IndexType dimension,
21  RandomAccessIterator begin,
22  RandomAccessIterator end)
23 {
24  DenseMatrix matrix(dimension, end-begin);
25  DenseVector feature_vector(dimension);
26 
27  for (RandomAccessIterator iter=begin; iter!=end; ++iter)
28  {
29  features.vector(*iter,feature_vector);
30  matrix.col(iter-begin).array() = feature_vector;
31  }
32 
33  return matrix;
34 }
35 
36 }
37 }
38 
39 #endif
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, Eigen::Dynamic > DenseMatrix
dense matrix type (non-overridable)
Definition: types.hpp:23
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, 1 > DenseVector
dense vector type (non-overridable)
Definition: types.hpp:21
DenseMatrix dense_matrix_from_features(FeaturesCallback features, IndexType dimension, RandomAccessIterator begin, RandomAccessIterator end)
Definition: features.hpp:19
int IndexType
indexing type (non-overridable) set to int for compatibility with OpenMP 2.0
Definition: types.hpp:19