[mlpack-git] master: Minor style fixes. (1b34ae0)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Wed Dec 2 16:06:15 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/c6c04e60c5953fb44b973ed691dbde0cc634a8f1...f11208f90fe2b0dddd32c966d39efb72a4da1db8
>---------------------------------------------------------------
commit 1b34ae0a759a61d639d88c23920e092ac7885d19
Author: Ryan Curtin <ryan at ratml.org>
Date: Wed Dec 2 13:05:30 2015 -0800
Minor style fixes.
>---------------------------------------------------------------
1b34ae0a759a61d639d88c23920e092ac7885d19
src/mlpack/tests/maximal_inputs_test.cpp | 39 +++++++++++++++++---------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/mlpack/tests/maximal_inputs_test.cpp b/src/mlpack/tests/maximal_inputs_test.cpp
index 32b6759..a65bba1 100644
--- a/src/mlpack/tests/maximal_inputs_test.cpp
+++ b/src/mlpack/tests/maximal_inputs_test.cpp
@@ -1,5 +1,5 @@
/**
- * @file MaximalInputs.cpp
+ * @file maximal_inputs_test.cpp
* @author Ngap Wei Tham
*
* Test the MaximalInputs and ColumnsToBlocks functions.
@@ -16,10 +16,10 @@ using namespace mlpack;
arma::mat CreateMaximalInput()
{
arma::mat w1(2, 4);
- w1<<0<<1<<2<<3<<arma::endr
- <<4<<5<<6<<7;
+ w1 << 0 << 1 << 2 << 3 << arma::endr
+ << 4 << 5 << 6 << 7;
- arma::mat input(5,5);
+ arma::mat input(5, 5);
input.submat(0, 0, 1, 3) = w1;
arma::mat maximalInputs;
@@ -28,10 +28,10 @@ arma::mat CreateMaximalInput()
return maximalInputs;
}
-void TestResults(arma::mat const &actualResult, arma::mat const &expectResult)
+void TestResults(const arma::mat&actualResult, const arma::mat& expectResult)
{
- BOOST_REQUIRE(expectResult.n_rows == actualResult.n_rows &&
- expectResult.n_cols == actualResult.n_cols);
+ BOOST_REQUIRE_EQUAL(expectResult.n_rows == actualResult.n_rows);
+ BOOST_REQUIRE_EQUAL(expectResult.n_cols == actualResult.n_cols);
for(size_t i = 0; i != expectResult.n_elem; ++i)
{
@@ -44,14 +44,16 @@ BOOST_AUTO_TEST_SUITE(MaximalInputsTest);
BOOST_AUTO_TEST_CASE(ColumnToBlocksEvaluate)
{
arma::mat output;
- mlpack::math::ColumnsToBlocks ctb(1,2);
+ mlpack::math::ColumnsToBlocks ctb(1, 2);
ctb.Transform(CreateMaximalInput(), output);
arma::mat matlabResults;
- matlabResults<<-1<<-1<<-1<<-1<<-1<<-1<<-1<<arma::endr
- <<-1<<-1<<-0.42857<<-1<<0.14286<<0.71429<<-1<<arma::endr
- <<-1<<-0.71429<<-0.14286<<-1.00000<<0.42857<<1<<-1<<arma::endr
- <<-1<<-1<<-1<<-1<<-1<<-1<<-1;
+ matlabResults << -1 << -1 << -1 << -1 << -1 << -1 << -1 << arma::endr
+ << -1 << -1<< -0.42857 << -1 << 0.14286 << 0.71429 << -1
+ << arma::endr
+ << -1 << -0.71429 << -0.14286 << -1 << 0.42857 << 1 << -1
+ << arma::endr
+ << -1 << -1 << -1 << -1 << -1 << -1 << -1;
TestResults(output, matlabResults);
}
@@ -59,18 +61,19 @@ BOOST_AUTO_TEST_CASE(ColumnToBlocksEvaluate)
BOOST_AUTO_TEST_CASE(ColumnToBlocksChangeBlockSize)
{
arma::mat output;
- mlpack::math::ColumnsToBlocks ctb(1,2);
+ mlpack::math::ColumnsToBlocks ctb(1, 2);
ctb.BlockWidth(4);
ctb.BlockHeight(1);
ctb.BufValue(-3);
ctb.Transform(CreateMaximalInput(), output);
arma::mat matlabResults;
- matlabResults<<-3<<-3<<-3<<-3<<-3
- <<-3<<-3<<-3<<-3<<-3<<-3<<arma::endr
- <<-3<<-1<<-0.71429<<-0.42857<<-0.14286
- <<-3<<0.14286<<0.42857<<0.71429<<1<<-3<<arma::endr
- <<-3<<-3<<-3<<-3<<-3<<-3<<-3<<-3<<-3<<-3<<-3<<arma::endr;
+ matlabResults<< -3 << -3 << -3 << -3 << -3
+ << -3 << -3 << -3 << -3 << -3 << -3 << arma::endr
+ << -3 << -1 << -0.71429 << -0.42857 << -0.14286
+ << -3 << 0.14286 << 0.42857 << 0.71429 << 1 << -3 << arma::endr
+ << -3 << -3 << -3 << -3 << -3 << -3 << -3 << -3 << -3 << -3
+ << -3 << arma::endr;
TestResults(output, matlabResults);
}
More information about the mlpack-git
mailing list