Fix clang warnings.

This commit is contained in:
Ryan Curtin
2018-02-09 11:15:36 -05:00
parent e547665748
commit b5b2c8d70c
7 changed files with 39 additions and 40 deletions
+2 -2
View File
@@ -203,10 +203,10 @@ struct NAME \
static typename \
std::enable_if<std::is_member_function_pointer<decltype(&Q::FUNC)>::value, \
int>::type \
f(int t) { return 1;} \
f(int) { return 1;} \
\
template <typename Q = T> \
static char f(char t) { return 0; } \
static char f(char) { return 0; } \
\
static const bool value = sizeof(f<T>(0)) != sizeof(char); \
};
@@ -203,7 +203,8 @@ class SVDCompleteIncrementalLearning<arma::sp_mat>
arma::mat& W,
const arma::mat& H)
{
if (!isStart) (*it)++;
if (!isStart)
++(*it);
else isStart = false;
if (*it == V.end())
@@ -234,12 +235,10 @@ class SVDCompleteIncrementalLearning<arma::sp_mat>
* @param W Basis matrix.
* @param H Encoding matrix to be updated.
*/
inline void HUpdate(const arma::sp_mat& V,
inline void HUpdate(const arma::sp_mat& /* V */,
const arma::mat& W,
arma::mat& H)
{
(void)V;
arma::mat deltaH(H.n_rows, 1);
deltaH.zeros();
@@ -169,7 +169,7 @@ inline void SVDIncompleteIncrementalLearning::WUpdate<arma::sp_mat>(
arma::mat deltaW(V.n_rows, W.n_cols);
deltaW.zeros();
for (arma::sp_mat::const_iterator it = V.begin_col(currentUserIndex);
it != V.end_col(currentUserIndex); it++)
it != V.end_col(currentUserIndex); ++it)
{
double val = *it;
size_t i = it.row();
@@ -189,7 +189,7 @@ inline void SVDIncompleteIncrementalLearning::HUpdate<arma::sp_mat>(
deltaH.zeros();
for (arma::sp_mat::const_iterator it = V.begin_col(currentUserIndex);
it != V.end_col(currentUserIndex); it++)
it != V.end_col(currentUserIndex); ++it)
{
double val = *it;
size_t i = it.row();
+1 -1
View File
@@ -383,7 +383,7 @@ ArmadilloGMMWrapper(const arma::mat& observations,
for (size_t i = 0; i < dists.size(); ++i)
{
dists[i].Mean() = g.means.col(i);
dists[i].Covariance(std::move(arma::diagmat(g.dcovs.col(i))));
dists[i].Covariance(arma::diagmat(g.dcovs.col(i)));
}
}
#endif
+1 -1
View File
@@ -169,7 +169,7 @@ static void mlpackMain()
secondHashSize, bucketSize);
Timer::Stop("hash_building");
}
else if (CLI::HasParam("input_model"))
else // We must have an input model.
{
allkann = CLI::GetParam<LSHSearch<>*>("input_model");
}
+21 -21
View File
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(ConstRowColIteratorTest)
mat::const_row_col_iterator it;
// Make sure ++ operator, operator* and comparison operators work fine.
size_t count = 0;
for (it = X.begin_row_col(); it != X.end_row_col(); it++)
for (it = X.begin_row_col(); it != X.end_row_col(); ++it)
{
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -79,14 +79,14 @@ BOOST_AUTO_TEST_CASE(ConstRowColIteratorTest)
BOOST_REQUIRE_EQUAL(it.row(), count % 5);
BOOST_REQUIRE_EQUAL(it.col(), count / 5);
count++;
++count;
}
BOOST_REQUIRE_EQUAL(count, 25);
it = X.end_row_col();
do
{
it--;
count--;
--it;
--count;
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(RowColIteratorTest)
mat::row_col_iterator it;
// Make sure ++ operator, operator* and comparison operators work fine.
size_t count = 0;
for (it = X.begin_row_col(); it != X.end_row_col(); it++)
for (it = X.begin_row_col(); it != X.end_row_col(); ++it)
{
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -125,14 +125,14 @@ BOOST_AUTO_TEST_CASE(RowColIteratorTest)
BOOST_REQUIRE_EQUAL(it.row(), count % 5);
BOOST_REQUIRE_EQUAL(it.col(), count / 5);
count++;
++count;
}
BOOST_REQUIRE_EQUAL(count, 25);
it = X.end_row_col();
do
{
it--;
count--;
--it;
--count;
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -155,14 +155,14 @@ BOOST_AUTO_TEST_CASE(MatRowColIteratorDecrementOperatorTest)
mat::row_col_iterator it1 = test.begin_row_col();
mat::row_col_iterator it2 = it1;
// check that postfix-- does not decrement the position when position is
// pointing to the begining
it2--;
// Check that postfix-- does not decrement the position when position is
// pointing to the beginning.
(void) it2--;
BOOST_REQUIRE_EQUAL(it1.row(), it2.row());
BOOST_REQUIRE_EQUAL(it1.col(), it2.col());
// check that prefix-- does not decrement the position when position is
// pointing to the begining
// Check that prefix-- does not decrement the position when position is
// pointing to the beginning.
--it2;
BOOST_REQUIRE_EQUAL(it1.row(), it2.row());
BOOST_REQUIRE_EQUAL(it1.col(), it2.col());
@@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(ConstSpRowColIteratorTest)
sp_mat::const_row_col_iterator it;
// Make sure ++ operator, operator* and comparison operators work fine.
size_t count = 1;
for (it = X.begin_row_col(); it != X.end_row_col(); it++)
for (it = X.begin_row_col(); it != X.end_row_col(); ++it)
{
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -196,14 +196,14 @@ BOOST_AUTO_TEST_CASE(ConstSpRowColIteratorTest)
BOOST_REQUIRE_EQUAL(it.row(), count % 5);
BOOST_REQUIRE_EQUAL(it.col(), count / 5);
count++;
++count;
}
BOOST_REQUIRE_EQUAL(count, 25);
it = X.end_row_col();
do
{
it--;
count--;
--it;
--count;
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(SpRowColIteratorTest)
sp_mat::row_col_iterator it;
// Make sure ++ operator, operator* and comparison operators work fine.
size_t count = 1;
for (it = X.begin_row_col(); it != X.end_row_col(); it++)
for (it = X.begin_row_col(); it != X.end_row_col(); ++it)
{
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -241,14 +241,14 @@ BOOST_AUTO_TEST_CASE(SpRowColIteratorTest)
BOOST_REQUIRE_EQUAL(it.row(), count % 5);
BOOST_REQUIRE_EQUAL(it.col(), count / 5);
count++;
++count;
}
BOOST_REQUIRE_EQUAL(count, 25);
it = X.end_row_col();
do
{
it--;
count--;
--it;
--count;
// Check iterator value.
BOOST_REQUIRE_EQUAL(*it, (count % 5) * 3 + (count / 5));
@@ -69,12 +69,12 @@ BOOST_AUTO_TEST_CASE(DecisionTreeOutputDimensionTest)
size_t testSize = testData.n_cols;
// Input training data.
SetInputParam("training", std::move(std::make_tuple(info, inputData)));
SetInputParam("training", std::make_tuple(info, inputData));
SetInputParam("labels", std::move(labels));
SetInputParam("weights", std::move(weights));
// Input test data.
SetInputParam("test", std::move(std::make_tuple(info, testData)));
SetInputParam("test", std::make_tuple(info, testData));
mlpackMain();
@@ -116,12 +116,12 @@ BOOST_AUTO_TEST_CASE(DecisionTreeCategoricalOutputDimensionTest)
size_t testSize = testData.n_cols;
// Input training data.
SetInputParam("training", std::move(std::make_tuple(info, inputData)));
SetInputParam("training", std::make_tuple(info, inputData));
SetInputParam("labels", std::move(labels));
SetInputParam("weights", std::move(weights));
// Input test data.
SetInputParam("test", std::move(std::make_tuple(info, testData)));
SetInputParam("test", std::make_tuple(info, testData));
mlpackMain();
@@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(DecisionModelReuseTest)
size_t testSize = testData.n_cols;
// Input training data.
SetInputParam("training", std::move(std::make_tuple(info, inputData)));
SetInputParam("training", std::make_tuple(info, inputData));
SetInputParam("labels", std::move(labels));
SetInputParam("weights", std::move(weights));
@@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(DecisionModelReuseTest)
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
// Input trained model.
SetInputParam("test", std::move(std::make_tuple(info, testData)));
SetInputParam("test", std::make_tuple(info, testData));
SetInputParam("input_model",
std::move(CLI::GetParam<DecisionTreeModel*>("output_model")));
@@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE(DecisionTreeTrainingVerTest)
arma::mat weights(1, labels.n_cols, arma::fill::ones);
// Input training data.
SetInputParam("training", std::move(std::make_tuple(info, inputData)));
SetInputParam("training", std::make_tuple(info, inputData));
SetInputParam("labels", std::move(labels));
SetInputParam("weights", std::move(weights));
@@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE(DecisionModelCategoricalReuseTest)
size_t testSize = testData.n_cols;
// Input training data.
SetInputParam("training", std::move(std::make_tuple(info, inputData)));
SetInputParam("training", std::make_tuple(info, inputData));
SetInputParam("labels", std::move(labels));
SetInputParam("weights", std::move(weights));
@@ -307,7 +307,7 @@ BOOST_AUTO_TEST_CASE(DecisionModelCategoricalReuseTest)
CLI::GetSingleton().Parameters()["test"].wasPassed = false;
// Input trained model.
SetInputParam("test", std::move(std::make_tuple(info, testData)));
SetInputParam("test", std::make_tuple(info, testData));
SetInputParam("input_model",
std::move(CLI::GetParam<DecisionTreeModel*>("output_model")));