Clean up warnings.

This commit is contained in:
Ryan Curtin
2011-12-15 00:21:39 +00:00
parent bb1e5a56a1
commit 7e280df886
7 changed files with 22 additions and 20 deletions
@@ -55,9 +55,9 @@ void KernelPCA<KernelType>::Apply(const arma::mat& data,
arma::mat kernelMat(centeredData.n_rows, centeredData.n_rows);
for(int i = 0; i < centeredData.n_rows; i++)
for (size_t i = 0; i < centeredData.n_rows; i++)
{
for(int j = 0; j < centeredData.n_rows; j++)
for (size_t j = 0; j < centeredData.n_rows; j++)
{
arma::vec v1 = trans(centeredData.row(i));
arma::vec v2 = trans(centeredData.row(j));
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
string distancesFile = CLI::GetParam<string>("distances_file");
string neighborsFile = CLI::GetParam<string>("neighbors_file");
int leafSize = CLI::GetParam<int>("leaf_size");
int lsInt = CLI::GetParam<int>("leaf_size");
size_t k = CLI::GetParam<int>("k");
@@ -87,11 +87,12 @@ int main(int argc, char *argv[])
}
// Sanity check on leaf size.
if (leafSize < 0)
if (lsInt < 0)
{
Log::Fatal << "Invalid leaf size: " << leafSize << ". Must be greater "
Log::Fatal << "Invalid leaf size: " << lsInt << ". Must be greater "
"than or equal to 0." << endl;
}
size_t leafSize = lsInt;
// Naive mode overrides single mode.
if (singleMode && naive)
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
string distancesFile = CLI::GetParam<string>("distances_file");
string neighborsFile = CLI::GetParam<string>("neighbors_file");
int leafSize = CLI::GetParam<int>("leaf_size");
int lsInt = CLI::GetParam<int>("leaf_size");
size_t k = CLI::GetParam<int>("k");
@@ -88,11 +88,12 @@ int main(int argc, char *argv[])
}
// Sanity check on leaf size.
if (leafSize < 0)
if (lsInt < 0)
{
Log::Fatal << "Invalid leaf size: " << leafSize << ". Must be greater "
Log::Fatal << "Invalid leaf size: " << lsInt << ". Must be greater "
"than or equal to 0." << endl;
}
size_t leafSize = lsInt;
// Naive mode overrides single mode.
if (singleMode && naive)
@@ -317,11 +317,6 @@ class NeighborSearch
//! Query dataset (may not be given).
const arma::mat& querySet;
//! Indicates if O(n^2) naive search is being used.
bool naive;
//! Indicates if single-tree search is being used (opposed to dual-tree).
bool singleMode;
//! Pointer to the root of the reference tree.
TreeType* referenceTree;
//! Pointer to the root of the query tree (might not exist).
@@ -332,6 +327,11 @@ class NeighborSearch
//! Indicates if we should free the query tree at deletion time.
bool ownQueryTree;
//! Indicates if O(n^2) naive search is being used.
bool naive;
//! Indicates if single-tree search is being used (opposed to dual-tree).
bool singleMode;
//! Instantiation of kernel.
MetricType metric;
@@ -25,12 +25,12 @@ NeighborSearch(const typename TreeType::Mat& referenceSet,
queryCopy(querySet),
referenceSet(referenceCopy),
querySet(queryCopy),
naive(naive),
singleMode(!naive && singleMode), // No single mode if naive.
referenceTree(NULL),
queryTree(NULL),
ownReferenceTree(true), // False if a tree was passed.
ownQueryTree(true), // False if a tree was passed.
naive(naive),
singleMode(!naive && singleMode), // No single mode if naive.
metric(metric),
numberOfPrunes(0)
{
@@ -64,12 +64,12 @@ NeighborSearch(const typename TreeType::Mat& referenceSet,
referenceCopy(referenceSet),
referenceSet(referenceCopy),
querySet(referenceCopy),
naive(naive),
singleMode(!naive && singleMode), // No single mode if naive.
referenceTree(NULL),
queryTree(NULL),
ownReferenceTree(true),
ownQueryTree(false), // Since it will be the same as referenceTree.
naive(naive),
singleMode(!naive && singleMode), // No single mode if naive.
metric(metric),
numberOfPrunes(0)
{
+2 -2
View File
@@ -84,14 +84,14 @@ void PCA::Apply(const arma::mat& data,
* from data matrix onto the basis vectors contained in the columns of
* coeff/eigen vector matrix with only newDimension number of columns chosen.
*/
void PCA::Apply(arma::mat& data, const int newDimension) const
void PCA::Apply(arma::mat& data, const size_t newDimension) const
{
arma::mat coeffs;
arma::vec eigVal;
Apply(data, data, eigVal, coeffs);
if(newDimension < coeffs.n_rows && newDimension > 0)
if (newDimension < coeffs.n_rows && newDimension > 0)
data.shed_rows(newDimension, data.n_rows - 1);
}
+1 -1
View File
@@ -49,7 +49,7 @@ class PCA
* from data matrix onto the basis vectors contained in the columns of
* coeff/eigen vector matrix with only newDimension number of columns chosen.
*/
void Apply(arma::mat& data, const int newDimension) const;
void Apply(arma::mat& data, const size_t newDimension) const;
/**
* Delete PCA object