[mlpack-git] master: Add documentation for element type. (fcaf28c)

gitdub at mlpack.org gitdub at mlpack.org
Mon Mar 7 14:59:46 EST 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/f45c17bc4d70ee5d82bf11a91850a34b814eccff...a69871c4eb63087c825502fd2277565453720568

>---------------------------------------------------------------

commit fcaf28c0820b3fd25ca851c738907837f7180bd3
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Mar 7 17:34:55 2016 +0000

    Add documentation for element type.


>---------------------------------------------------------------

fcaf28c0820b3fd25ca851c738907837f7180bd3
 doc/policies/elemtype.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/doc/policies/elemtype.hpp b/doc/policies/elemtype.hpp
new file mode 100644
index 0000000..f83a1f2
--- /dev/null
+++ b/doc/policies/elemtype.hpp
@@ -0,0 +1,42 @@
+/*! @page elem The ElemType policy in mlpack
+
+ at section Overview
+
+\b mlpack algorithms should be as generic as possible.  Often this means
+allowing arbitrary metrics or kernels to be used, but this also means allowing
+any type of data point to be used.  This means that \b mlpack classes should
+support \c float, \c double, and other observation types.  Some algorithms
+support this through the use of a \c MatType template parameter; others will
+have their own template parameter, \c ElemType.
+
+The \c ElemType template parameter can take any value that can be used by
+Armadillo (or, specifically, classes like \c arma::Mat<> and others); this
+encompasses the types
+
+ - \c double
+ - \c float
+ - \c int
+ - \c unsigned int
+ - \c std::complex<double>
+ - \c std::complex<float>
+
+and other primitive numeric types.  Note that Armadillo does not support some
+integer types for functionality such as matrix decompositions or other more
+advanced linear algebra.  This means that when these integer types are used,
+some algorithms may fail with Armadillo error messages indicating that those
+types cannot be used.
+
+ at section A note for developers
+
+If the class has a \c MatType template parameter, \c ElemType can be easily
+defined as below:
+
+ at code
+typedef typename MatType::elem_type ElemType;
+ at endcode
+
+and otherwise a template parameter with the name \c ElemType can be used.  It is
+generally a good idea to expose the element type somehow for use by other
+classes.
+
+*/




More information about the mlpack-git mailing list