[mlpack-git] master: class instead of struct. (316ef33)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Mon Aug 31 15:46:12 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/fab25eaf7b9630076fd3b980e43a25363a936d28...b34381d94ec4d8f026a2954f8376b9df5a4d661d
>---------------------------------------------------------------
commit 316ef3374264ad9dd45c95fb3497a9df5a022db2
Author: Ryan Curtin <ryan at ratml.org>
Date: Mon Aug 31 15:39:27 2015 +0000
class instead of struct.
>---------------------------------------------------------------
316ef3374264ad9dd45c95fb3497a9df5a022db2
doc/policies/kernels.hpp | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/doc/policies/kernels.hpp b/doc/policies/kernels.hpp
index b02d598..3a35382 100644
--- a/doc/policies/kernels.hpp
+++ b/doc/policies/kernels.hpp
@@ -108,27 +108,28 @@ int main()
}
@endcode
- at section kerneltraits The KernelTraits struct
+ at section kerneltraits The KernelTraits trait class
Some algorithms that use kernels can specialize if the kernel fulfills some
certain conditions. An example of a condition might be that the kernel is
shift-invariant or that the kernel is normalized. In the case of fast
max-kernel search (mlpack::fastmks::FastMKS), the computation can be accelerated
-if the kernel is normalized. For this reason, the \c KernelTraits struct
+if the kernel is normalized. For this reason, the \c KernelTraits trait class
exists. This allows a kernel to specify via a \c const \c static \c bool when
these types of conditions are satisfied. **Note that a KernelTraits class
is not required,** but may be helpful.
-The \c KernelTraits struct is a template struct that takes a \c KernelType as a
-parameter, and exposes \c const \c static \c bool values that depend on the
+The \c KernelTraits trait class is a template class that takes a \c KernelType
+as a parameter, and exposes \c const \c static \c bool values that depend on the
kernel. Setting these values is achieved by specialization. The code below
provides an example, specializing \c KernelTraits for the \c ExampleKernel from
earlier:
@code
template<>
-struct KernelTraits<ExampleKernel>
+class KernelTraits<ExampleKernel>
{
+ public:
//! The example kernel is normalized (K(x, x) = 1 for all x).
const static bool IsNormalized = true;
};
More information about the mlpack-git
mailing list