MachineIntelligenceCore:Algorithms
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ColMatrixEncoder.hpp
Go to the documentation of this file.
1 
23 #ifndef COLMATRIXENCODER_H_
24 #define COLMATRIXENCODER_H_
25 
27 
28 namespace mic {
29 namespace encoders {
30 
37 template<typename T = float>
38 class ColMatrixEncoder : public mic::encoders::MatrixSDREncoder<mic::types::Matrix<T>, T> {
39 public:
40 
46  ColMatrixEncoder(size_t matrix_height_, size_t matrix_width_) : MatrixSDREncoder<mic::types::Matrix<T>, T>(matrix_height_*matrix_width_),
47  matrix_height(matrix_height_),
48  matrix_width(matrix_width_)
49  {
50 // std::cout<<" Hello MatrixXfMatrixXfEncoder\n";
51  };
52 
55 
62  // Create new matrix.
63  mic::types::MatrixPtr<T> sdr (new mic::types::Matrix<T>(sample_->cols(), sample_->rows()));
64  // Copy data.
65  (*sdr) = (*sample_);
66  // Resize.
67  sdr->resize(sdr_length, 1);
68  return sdr;
69  }
70 
77  // Create new matrix.
78  mic::types::MatrixPtr<T> decoded (new mic::types::Matrix<T>(sdr_->cols(), sdr_->rows()));
79  // Copy data.
80  (*decoded) = (*sdr_);
81  // Resize.
82  decoded->resize(matrix_height, matrix_width);
83  return decoded;
84  }
85 
86 protected:
88  size_t matrix_height;
89 
91  size_t matrix_width;
92 
93 private:
95 
96 };
97 
98 
99 
100 } /* namespace encoders */
101 } /* namespace mic */
102 
103 #endif /* COLMATRIXENCODER_H_ */
virtual mic::types::MatrixPtr< T > decodeSample(const mic::types::MatrixPtr< T > &sdr_)
size_t matrix_width
Width of the matrix - number of columns.
Abstract parent class for all encoders using MatrixXf as SDR datatype.
ColMatrixEncoder(size_t matrix_height_, size_t matrix_width_)
virtual mic::types::MatrixPtr< T > encodeSample(const mic::types::MatrixPtr< T > &sample_)
Method responsible for encoding of input data sample into SDR (a 1D matrix - vector of floats)...
size_t matrix_height
Height of the matrix - number of rows.
typename std::shared_ptr< mic::types::Matrix< T > > MatrixPtr
Typedef for a shared pointer to template-typed dynamic matrices.
Definition: Matrix.hpp:479
Template-typed Matrix of dynamic size. Uses OpenBLAS if found by CMAKE - overloaded, specializations of * operator for types: float, double.
Definition: Matrix.hpp:64
~ColMatrixEncoder()
Default destructor - empty.
Encoder responsible for encoding single channel (float) matrices (e.g. grayscale images) into SDRs...