[mlpack-git] master: Fix compiler warnings (ee2a8a1)
gitdub at mlpack.org
gitdub at mlpack.org
Tue Jul 12 08:46:39 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/e434aee1eab9e3ced97cccd840dd383ef8089acf...81c14d9ec8250f8a2caaf1ac06c4be12fc5fd31f
>---------------------------------------------------------------
commit ee2a8a1461a33edd830747dccde117ac2cfb12b7
Author: Mikhail Lozhnikov <lozhnikovma at gmail.com>
Date: Tue Jul 12 15:46:39 2016 +0300
Fix compiler warnings
>---------------------------------------------------------------
ee2a8a1461a33edd830747dccde117ac2cfb12b7
.../core/tree/rectangle_tree/r_plus_tree_split_impl.hpp | 11 +++++++----
src/mlpack/methods/adaboost/adaboost_impl.hpp | 2 +-
src/mlpack/methods/ann/layer/one_hot_layer.hpp | 2 +-
src/mlpack/methods/ann/layer/vr_class_reward_layer.hpp | 2 +-
src/mlpack/methods/perceptron/perceptron_impl.hpp | 2 +-
src/mlpack/methods/radical/radical.cpp | 2 +-
6 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp
index 8dfc2f2..67025d5 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp
@@ -22,6 +22,8 @@ template<typename TreeType>
void RPlusTreeSplit<SplitPolicyType, SweepType>::
SplitLeafNode(TreeType* tree, std::vector<bool>& relevels)
{
+ typedef typename TreeType::ElemType ElemType;
+
if (tree->Count() == 1)
{
// Check if an intermediate node was added during the insertion process.
@@ -64,8 +66,8 @@ SplitLeafNode(TreeType* tree, std::vector<bool>& relevels)
return;
}
- size_t cutAxis;
- typename TreeType::ElemType cut;
+ size_t cutAxis = tree->Bound().Dim();
+ ElemType cut = std::numeric_limits<ElemType>::lowest();
// Try to find a partiotion of the node.
if (!PartitionNode(tree, cutAxis, cut))
@@ -117,6 +119,7 @@ template<typename TreeType>
bool RPlusTreeSplit<SplitPolicyType, SweepType>::
SplitNonLeafNode(TreeType* tree, std::vector<bool>& relevels)
{
+ typedef typename TreeType::ElemType ElemType;
// If we are splitting the root node, we need will do things differently so
// that the constructor and other methods don't confuse the end user by giving
// an address of another node.
@@ -133,8 +136,8 @@ SplitNonLeafNode(TreeType* tree, std::vector<bool>& relevels)
RPlusTreeSplit::SplitNonLeafNode(copy,relevels);
return true;
}
- size_t cutAxis;
- typename TreeType::ElemType cut;
+ size_t cutAxis = tree->Bound().Dim();
+ ElemType cut = std::numeric_limits<ElemType>::lowest();
// Try to find a partiotion of the node.
if ( !PartitionNode(tree, cutAxis, cut))
diff --git a/src/mlpack/methods/adaboost/adaboost_impl.hpp b/src/mlpack/methods/adaboost/adaboost_impl.hpp
index a692a32..55d77f2 100644
--- a/src/mlpack/methods/adaboost/adaboost_impl.hpp
+++ b/src/mlpack/methods/adaboost/adaboost_impl.hpp
@@ -208,7 +208,7 @@ void AdaBoost<WeakLearnerType, MatType>::Classify(
}
arma::colvec cMRow;
- arma::uword maxIndex;
+ arma::uword maxIndex = 0;
for (size_t i = 0; i < predictedLabels.n_cols; i++)
{
diff --git a/src/mlpack/methods/ann/layer/one_hot_layer.hpp b/src/mlpack/methods/ann/layer/one_hot_layer.hpp
index 99a52da..671696e 100644
--- a/src/mlpack/methods/ann/layer/one_hot_layer.hpp
+++ b/src/mlpack/methods/ann/layer/one_hot_layer.hpp
@@ -58,7 +58,7 @@ class OneHotLayer
output = inputActivations;
output.zeros();
- arma::uword maxIndex;
+ arma::uword maxIndex = 0;
inputActivations.max(maxIndex);
output(maxIndex) = 1;
}
diff --git a/src/mlpack/methods/ann/layer/vr_class_reward_layer.hpp b/src/mlpack/methods/ann/layer/vr_class_reward_layer.hpp
index 95692f0..aec0b85 100644
--- a/src/mlpack/methods/ann/layer/vr_class_reward_layer.hpp
+++ b/src/mlpack/methods/ann/layer/vr_class_reward_layer.hpp
@@ -71,7 +71,7 @@ class VRClassRewardLayer
double Forward(const arma::Mat<eT>& input, const arma::Mat<eT>& target)
{
reward = 0;
- arma::uword index;
+ arma::uword index = 0;
for (size_t i = 0; i < input.n_cols; i++)
{
diff --git a/src/mlpack/methods/perceptron/perceptron_impl.hpp b/src/mlpack/methods/perceptron/perceptron_impl.hpp
index 68c5f51..2e2948f 100644
--- a/src/mlpack/methods/perceptron/perceptron_impl.hpp
+++ b/src/mlpack/methods/perceptron/perceptron_impl.hpp
@@ -108,7 +108,7 @@ void Perceptron<LearnPolicy, WeightInitializationPolicy, MatType>::Classify(
arma::Row<size_t>& predictedLabels)
{
arma::vec tempLabelMat;
- arma::uword maxIndex;
+ arma::uword maxIndex = 0;
// Could probably be faster if done in batch.
for (size_t i = 0; i < test.n_cols; i++)
diff --git a/src/mlpack/methods/radical/radical.cpp b/src/mlpack/methods/radical/radical.cpp
index 18ec45f..816e8e6 100644
--- a/src/mlpack/methods/radical/radical.cpp
+++ b/src/mlpack/methods/radical/radical.cpp
@@ -85,7 +85,7 @@ double Radical::DoRadical2D(const mat& matX)
values(i) = Vasicek(candidateY1) + Vasicek(candidateY2);
}
- uword indOpt;
+ uword indOpt = 0;
values.min(indOpt); // we ignore the return value; we don't care about it
return (indOpt / (double) angles) * M_PI / 2.0;
}
More information about the mlpack-git
mailing list