/usr/include/mlpack/core/util/arma_traits.hpp is in libmlpack-dev 1.0.10-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /**
* @file arma_traits.hpp
* @author Ryan Curtin
*
* Some traits used for template metaprogramming (SFINAE) with Armadillo types.
*
* This file is part of MLPACK 1.0.10.
*
* MLPACK is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details (LICENSE.txt).
*
* You should have received a copy of the GNU General Public License along with
* MLPACK. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MLPACK_CORE_UTIL_ARMA_TRAITS_HPP
#define __MLPACK_CORE_UTIL_ARMA_TRAITS_HPP
// Structs have public members by default (that's why they are chosen over
// classes).
/**
* If value == true, then VecType is some sort of Armadillo vector or subview.
* You might use this struct like this:
*
* @code
* // Only accepts VecTypes that are actually Armadillo vector types.
* template<typename VecType>
* void Function(const VecType& argumentA,
* typename boost::enable_if<IsVector<VecType> >* = 0);
* @endcode
*
* The use of the enable_if object allows the compiler to instantiate Function()
* only if VecType is one of the Armadillo vector types. It has a default
* argument because it isn't meant to be used in either the function call or the
* function body.
*/
template<typename VecType>
struct IsVector
{
const static bool value = false;
};
// Commenting out the first template per case, because
//Visual Studio doesn't like this instantiaion pattern (error C2910).
//template<>
template<typename eT>
struct IsVector<arma::Col<eT> >
{
const static bool value = true;
};
//template<>
template<typename eT>
struct IsVector<arma::SpCol<eT> >
{
const static bool value = true;
};
//template<>
template<typename eT>
struct IsVector<arma::Row<eT> >
{
const static bool value = true;
};
//template<>
template<typename eT>
struct IsVector<arma::SpRow<eT> >
{
const static bool value = true;
};
//template<>
template<typename eT>
struct IsVector<arma::subview_col<eT> >
{
const static bool value = true;
};
//template<>
template<typename eT>
struct IsVector<arma::subview_row<eT> >
{
const static bool value = true;
};
// I'm not so sure about this one. An SpSubview object can be a row or column,
// but it can also be a matrix subview.
//template<>
template<typename eT>
struct IsVector<arma::SpSubview<eT> >
{
const static bool value = true;
};
#endif
|