mlpack
columns_to_blocks.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_NN_COLUMNS_TO_BLOCKS_HPP
14 #define MLPACK_METHODS_NN_COLUMNS_TO_BLOCKS_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace math {
20 
107 {
108  public:
132  ColumnsToBlocks(size_t rows,
133  size_t cols,
134  size_t blockHeight = 0,
135  size_t blockWidth = 0);
136 
146  void Transform(const arma::mat& maximalInputs, arma::mat& output);
147 
149  void BlockHeight(const size_t value) { blockHeight = value; }
151  size_t BlockHeight() const { return blockHeight; }
152 
154  void BlockWidth(size_t value) { blockWidth = value; }
156  size_t BlockWidth() const { return blockWidth; }
157 
160  void BufSize(const size_t value) { bufSize = value; }
162  size_t BufSize() const { return bufSize; }
163 
165  void BufValue(const double value) { bufValue = value; }
167  double BufValue() const { return bufValue; }
168 
171  void MaxRange(const double value) { maxRange = value; }
174  double MaxRange() const { return maxRange; }
175 
178  void MinRange(const double value) { minRange = value; }
181  double MinRange() const { return minRange; }
182 
185  void Scale(const bool value) { scale = value; }
188  bool Scale() const { return scale; }
189 
191  void Rows(const size_t value) { rows = value; }
193  size_t Rows() const { return rows; }
194 
196  void Cols(const size_t value) { cols = value; }
198  size_t Cols() const { return cols; }
199 
200  private:
202  bool IsPerfectSquare(size_t value) const;
203 
205  size_t blockHeight;
207  size_t blockWidth;
209  size_t bufSize;
211  double bufValue;
213  double minRange;
215  double maxRange;
217  bool scale;
219  size_t rows;
221  size_t cols;
222 };
223 
224 } // namespace math
225 } // namespace mlpack
226 
227 #endif
size_t BlockWidth() const
Get the block width.
Definition: columns_to_blocks.hpp:156
double MinRange() const
Get the minimum of the range the input will be scaled to, if scaling is enabled (see Scale())...
Definition: columns_to_blocks.hpp:181
size_t Rows() const
Modify the number of blocks per row.
Definition: columns_to_blocks.hpp:193
void MinRange(const double value)
Set the minimum of the range the input will be scaled to, if scaling is enabled (see Scale())...
Definition: columns_to_blocks.hpp:178
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
double BufValue() const
Get the value used for buffer cells.
Definition: columns_to_blocks.hpp:167
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Rows(const size_t value)
Set the number of blocks per row.
Definition: columns_to_blocks.hpp:191
ColumnsToBlocks(size_t rows, size_t cols, size_t blockHeight=0, size_t blockWidth=0)
Constructor a ColumnsToBlocks object with the given parameters.
Definition: columns_to_blocks.cpp:17
void Transform(const arma::mat &maximalInputs, arma::mat &output)
Transform the columns of the input matrix into blocks.
Definition: columns_to_blocks.cpp:39
size_t Cols() const
Return the number of blocks per column.
Definition: columns_to_blocks.hpp:198
void MaxRange(const double value)
Set the maximum of the range the input will be scaled to, if scaling is enabled (see Scale())...
Definition: columns_to_blocks.hpp:171
bool Scale() const
Get whether or not scaling is enabled (see also MaxRange() and MinRange()).
Definition: columns_to_blocks.hpp:188
void Cols(const size_t value)
Set the number of blocks per column.
Definition: columns_to_blocks.hpp:196
void BufValue(const double value)
Modify the value used for buffer cells; the default is -1.
Definition: columns_to_blocks.hpp:165
void BlockHeight(const size_t value)
Set the height of each block; see the constructor for more details.
Definition: columns_to_blocks.hpp:149
Transform the columns of the given matrix into a block format.
Definition: columns_to_blocks.hpp:106
void BufSize(const size_t value)
Modify the buffer size (the size of the margin around each column of the input).
Definition: columns_to_blocks.hpp:160
double MaxRange() const
Get the maximum of the range the input will be scaled to, if scaling is enabled (see Scale())...
Definition: columns_to_blocks.hpp:174
size_t BlockHeight() const
Get the block height.
Definition: columns_to_blocks.hpp:151
void Scale(const bool value)
Set whether or not scaling is enabled (see also MaxRange() and MinRange()).
Definition: columns_to_blocks.hpp:185
size_t BufSize() const
Get the buffer size.
Definition: columns_to_blocks.hpp:162
void BlockWidth(size_t value)
Set the width of each block; see the constructor for more details.
Definition: columns_to_blocks.hpp:154