mlpack  2.0.1
columns_to_blocks.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_NN_COLUMNS_TO_BLOCKS_HPP
16 #define __MLPACK_METHODS_NN_COLUMNS_TO_BLOCKS_HPP
17 
18 #include <mlpack/core.hpp>
19 
20 namespace mlpack {
21 namespace math {
22 
109 {
110  public:
134  ColumnsToBlocks(size_t rows,
135  size_t cols,
136  size_t blockHeight = 0,
137  size_t blockWidth = 0);
138 
148  void Transform(const arma::mat& maximalInputs, arma::mat& output);
149 
151  void BlockHeight(const size_t value) { blockHeight = value; }
153  size_t BlockHeight() const { return blockHeight; }
154 
156  void BlockWidth(size_t value) { blockWidth = value; }
158  size_t BlockWidth() const { return blockWidth; }
159 
162  void BufSize(const size_t value) { bufSize = value; }
164  size_t BufSize() const { return bufSize; }
165 
167  void BufValue(const double value) { bufValue = value; }
169  double BufValue() const { return bufValue; }
170 
173  void MaxRange(const double value) { maxRange = value; }
176  double MaxRange() const { return maxRange; }
177 
180  void MinRange(const double value) { minRange = value; }
183  double MinRange() const { return minRange; }
184 
187  void Scale(const bool value) { scale = value; }
190  bool Scale() const { return scale; }
191 
193  void Rows(const size_t value) { rows = value; }
195  size_t Rows() const { return rows; }
196 
198  void Cols(const size_t value) { cols = value; }
200  size_t Cols() const { return cols; }
201 
202  private:
204  bool IsPerfectSquare(size_t value) const;
205 
207  size_t blockHeight;
209  size_t blockWidth;
211  size_t bufSize;
213  double bufValue;
215  double minRange;
217  double maxRange;
219  bool scale;
221  size_t rows;
223  size_t cols;
224 };
225 
226 } // namespace math
227 } // namespace mlpack
228 
229 #endif
double minRange
The minimum of the range to be scaled to (if scaling is enabled).
size_t BlockWidth() const
Get the block width.
double MinRange() const
Get the minimum of the range the input will be scaled to, if scaling is enabled (see Scale())...
size_t Rows() const
Modify the number of blocks per row.
void MinRange(const double value)
Set the minimum of the range the input will be scaled to, if scaling is enabled (see Scale())...
Linear algebra utility functions, generally performed on matrices or vectors.
double BufValue() const
Get the value used for buffer cells.
void Rows(const size_t value)
Set the number of blocks per row.
size_t blockHeight
The height of each block.
size_t cols
The number of blocks in each column.
double maxRange
The maximum of the range to be scaled to (if scaling is enabled).
ColumnsToBlocks(size_t rows, size_t cols, size_t blockHeight=0, size_t blockWidth=0)
Constructor a ColumnsToBlocks object with the given parameters.
bool IsPerfectSquare(size_t value) const
Determine whether or not the number is a perfect square.
void Transform(const arma::mat &maximalInputs, arma::mat &output)
Transform the columns of the input matrix into blocks.
size_t Cols() const
Return the number of blocks per column.
void MaxRange(const double value)
Set the maximum of the range the input will be scaled to, if scaling is enabled (see Scale())...
bool Scale() const
Get whether or not scaling is enabled (see also MaxRange() and MinRange()).
void Cols(const size_t value)
Set the number of blocks per column.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
bool scale
Whether or not scaling is enabled.
void BufValue(const double value)
Modify the value used for buffer cells; the default is -1.
void BlockHeight(const size_t value)
Set the height of each block; see the constructor for more details.
size_t blockWidth
The width of each block.
Transform the columns of the given matrix into a block format.
void BufSize(const size_t value)
Modify the buffer size (the size of the margin around each column of the input).
double MaxRange() const
Get the maximum of the range the input will be scaled to, if scaling is enabled (see Scale())...
size_t bufSize
The size of the buffer around each block.
size_t rows
The number of blocks in each row.
size_t BlockHeight() const
Get the block height.
double bufValue
The value of the buffer around each block.
void Scale(const bool value)
Set whether or not scaling is enabled (see also MaxRange() and MinRange()).
size_t BufSize() const
Get the buffer size.
void BlockWidth(size_t value)
Set the width of each block; see the constructor for more details.