[mlpack] 204/324: Refactor to be stricter with types (arma::Col<size_t> instead of arma::vec).
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:22:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit 93b513839bda199764a367a7b0373ebbdfc4036a
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Mon Jul 21 14:58:53 2014 +0000
Refactor to be stricter with types (arma::Col<size_t> instead of arma::vec).
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16846 9d5b8971-822b-0410-80eb-d18c1038ef23
---
.../methods/nystroem_method/kmeans_selection.hpp | 2 +-
.../methods/nystroem_method/nystroem_method.hpp | 2 +-
.../methods/nystroem_method/nystroem_method_impl.hpp | 20 ++++++++++----------
.../methods/nystroem_method/ordered_selection.hpp | 6 +++---
.../methods/nystroem_method/random_selection.hpp | 4 ++--
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/mlpack/methods/nystroem_method/kmeans_selection.hpp b/src/mlpack/methods/nystroem_method/kmeans_selection.hpp
index f931d74..ea6cbbc 100644
--- a/src/mlpack/methods/nystroem_method/kmeans_selection.hpp
+++ b/src/mlpack/methods/nystroem_method/kmeans_selection.hpp
@@ -20,7 +20,7 @@ class KMeansSelection
public:
/**
* Use the K-Means clustering method to select the specified number of points
- * in the dataset.
+ * in the dataset. You are responsible for deleting the returned matrix!
*
* @param data Dataset to sample from.
* @param m Number of points to select.
diff --git a/src/mlpack/methods/nystroem_method/nystroem_method.hpp b/src/mlpack/methods/nystroem_method/nystroem_method.hpp
index fc91d6e..0d01b36 100644
--- a/src/mlpack/methods/nystroem_method/nystroem_method.hpp
+++ b/src/mlpack/methods/nystroem_method/nystroem_method.hpp
@@ -59,7 +59,7 @@ class NystroemMethod
* @param miniKernel to store the constructed mini-kernel matrix in.
* @param miniKernel to store the constructed semi-kernel matrix in.
*/
- void GetKernelMatrix(const arma::vec& points,
+ void GetKernelMatrix(const arma::Col<size_t>& selectedPoints,
arma::mat& miniKernel,
arma::mat& semiKernel);
diff --git a/src/mlpack/methods/nystroem_method/nystroem_method_impl.hpp b/src/mlpack/methods/nystroem_method/nystroem_method_impl.hpp
index 231ecbf..e8d68f7 100644
--- a/src/mlpack/methods/nystroem_method/nystroem_method_impl.hpp
+++ b/src/mlpack/methods/nystroem_method/nystroem_method_impl.hpp
@@ -26,31 +26,31 @@ NystroemMethod<KernelType, PointSelectionPolicy>::NystroemMethod(
template<typename KernelType, typename PointSelectionPolicy>
void NystroemMethod<KernelType, PointSelectionPolicy>::GetKernelMatrix(
- const arma::mat* seletedData,
- arma::mat& miniKernel,
- arma::mat& semiKernel)
+ const arma::mat* selectedData,
+ arma::mat& miniKernel,
+ arma::mat& semiKernel)
{
// Assemble mini-kernel matrix.
for (size_t i = 0; i < rank; ++i)
for (size_t j = 0; j < rank; ++j)
- miniKernel(i, j) = kernel.Evaluate(seletedData->col(i),
- seletedData->col(j));
+ miniKernel(i, j) = kernel.Evaluate(selectedData->col(i),
+ selectedData->col(j));
// Construct semi-kernel matrix with interactions between selected data and
// all points.
for (size_t i = 0; i < data.n_cols; ++i)
for (size_t j = 0; j < rank; ++j)
semiKernel(i, j) = kernel.Evaluate(data.col(i),
- seletedData->col(j));
+ selectedData->col(j));
// Clean the memory.
- delete seletedData;
+ delete selectedData;
}
template<typename KernelType, typename PointSelectionPolicy>
void NystroemMethod<KernelType, PointSelectionPolicy>::GetKernelMatrix(
- const arma::vec& selectedPoints,
- arma::mat& miniKernel,
- arma::mat& semiKernel)
+ const arma::Col<size_t>& selectedPoints,
+ arma::mat& miniKernel,
+ arma::mat& semiKernel)
{
// Assemble mini-kernel matrix.
for (size_t i = 0; i < rank; ++i)
diff --git a/src/mlpack/methods/nystroem_method/ordered_selection.hpp b/src/mlpack/methods/nystroem_method/ordered_selection.hpp
index 154c04e..9e9e32e 100644
--- a/src/mlpack/methods/nystroem_method/ordered_selection.hpp
+++ b/src/mlpack/methods/nystroem_method/ordered_selection.hpp
@@ -24,11 +24,11 @@ class OrderedSelection
* @param m Number of points to select.
* @return Indices of selected points from the dataset.
*/
- const static arma::vec Select(const arma::mat& /* unused */, const size_t m)
+ const static arma::Col<size_t> Select(const arma::mat& /* unused */,
+ const size_t m)
{
// This generates [0 1 2 3 ... (m - 1)].
- arma::vec selectedPoints = arma::linspace<arma::vec>(0, m - 1, m);
- return selectedPoints;
+ return arma::linspace<arma::Col<size_t> >(0, m - 1, m);
}
};
diff --git a/src/mlpack/methods/nystroem_method/random_selection.hpp b/src/mlpack/methods/nystroem_method/random_selection.hpp
index 83b09cc..39dfa12 100644
--- a/src/mlpack/methods/nystroem_method/random_selection.hpp
+++ b/src/mlpack/methods/nystroem_method/random_selection.hpp
@@ -24,9 +24,9 @@ class RandomSelection
* @param m Number of points to select.
* @return Indices of selected points from the dataset.
*/
- const static arma::vec Select(const arma::mat& data, const size_t m)
+ const static arma::Col<size_t> Select(const arma::mat& data, const size_t m)
{
- arma::vec selectedPoints(m);
+ arma::Col<size_t> selectedPoints(m);
for (size_t i = 0; i < m; ++i)
selectedPoints(i) = math::RandInt(0, data.n_cols);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list