Details to improve code and documentation.

This commit is contained in:
MarcosPividori
2016-06-15 23:13:35 -03:00
parent ddb252ce03
commit 83f1925bb2
2 changed files with 13 additions and 9 deletions
@@ -58,7 +58,7 @@ class MonoSearchVisitor : public boost::static_visitor<void>
public:
template<typename NSType>
void operator()(NSType *ns) const;
void operator()(NSType* ns) const;
MonoSearchVisitor(const size_t k,
arma::Mat<size_t>& neighbors,
@@ -132,7 +132,7 @@ class SingleModeVisitor : public boost::static_visitor<bool&>
{
public:
template<typename NSType>
bool& operator()(NSType *ns) const;
bool& operator()(NSType* ns) const;
};
class NaiveVisitor : public boost::static_visitor<bool&>
@@ -220,15 +220,19 @@ class NSModel
bool SingleMode() const;
bool& SingleMode();
//! Expose naiveMode.
bool Naive() const;
bool& Naive();
//! Expose leafSize.
size_t LeafSize() const { return leafSize; }
size_t& LeafSize() { return leafSize; }
//! Expose treeType.
TreeTypes TreeType() const { return treeType; }
TreeTypes& TreeType() { return treeType; }
//! Expose randomBasis.
bool RandomBasis() const { return randomBasis; }
bool& RandomBasis() { return randomBasis; }
@@ -74,7 +74,7 @@ void BiSearchVisitor<SortPolicy>::operator()(NSTypeT<tree::BallTree>* ns) const
template<typename SortPolicy>
template<typename NSType>
void BiSearchVisitor<SortPolicy>::SearchLeaf(NSType *ns) const
void BiSearchVisitor<SortPolicy>::SearchLeaf(NSType* ns) const
{
if (!ns->Naive() && !ns->SingleMode())
{
@@ -156,7 +156,7 @@ void TrainVisitor<SortPolicy>::TrainLeaf(NSType* ns) const
template<typename NSType>
bool& SingleModeVisitor::operator()(NSType *ns) const
bool& SingleModeVisitor::operator()(NSType* ns) const
{
if (ns)
return ns->SingleMode();
@@ -165,7 +165,7 @@ bool& SingleModeVisitor::operator()(NSType *ns) const
template<typename NSType>
bool& NaiveVisitor::operator()(NSType *ns) const
bool& NaiveVisitor::operator()(NSType* ns) const
{
if (ns)
return ns->Naive();
@@ -174,7 +174,7 @@ bool& NaiveVisitor::operator()(NSType *ns) const
template<typename NSType>
const arma::mat& ReferenceSetVisitor::operator()(NSType *ns) const
const arma::mat& ReferenceSetVisitor::operator()(NSType* ns) const
{
if (ns)
return ns->ReferenceSet();
@@ -183,7 +183,7 @@ const arma::mat& ReferenceSetVisitor::operator()(NSType *ns) const
template<typename NSType>
void DeleteVisitor::operator()(NSType *ns) const
void DeleteVisitor::operator()(NSType* ns) const
{
if (ns)
delete ns;
@@ -199,7 +199,7 @@ SerializeVisitor<Archive>::SerializeVisitor(Archive& ar,
template<typename Archive>
template<typename NSType>
void SerializeVisitor<Archive>::operator()(NSType *ns) const
void SerializeVisitor<Archive>::operator()(NSType* ns) const
{
ar & data::CreateNVP(ns, name);
}
@@ -349,7 +349,7 @@ void NSModel<SortPolicy>::BuildModel(arma::mat&& referenceSet,
break;
}
TrainVisitor<SortPolicy> tn(std::move(referenceSet),leafSize);
TrainVisitor<SortPolicy> tn(std::move(referenceSet), leafSize);
boost::apply_visitor(tn, nSearch);
if (!naive)