Mercurial > hg > segmenter-vamp-plugin
diff armadillo-3.900.4/include/armadillo_bits/subview_each_bones.hpp @ 49:1ec0e2823891
Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author | Chris Cannam |
---|---|
date | Thu, 13 Jun 2013 10:25:24 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/armadillo-3.900.4/include/armadillo_bits/subview_each_bones.hpp Thu Jun 13 10:25:24 2013 +0100 @@ -0,0 +1,115 @@ +// Copyright (C) 2012 Conrad Sanderson +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +//! \addtogroup subview_each +//! @{ + + + +template<typename parent, unsigned int mode> +class subview_each_common + { + public: + + typedef typename parent::elem_type eT; + + + protected: + + parent& p; + + arma_inline subview_each_common(parent& in_p); + + arma_inline const Mat<typename parent::elem_type>& get_mat_ref_helper(const Mat <typename parent::elem_type>& X) const; + arma_inline const Mat<typename parent::elem_type>& get_mat_ref_helper(const subview<typename parent::elem_type>& X) const; + + arma_inline const Mat<typename parent::elem_type>& get_mat_ref() const; + + inline void check_size(const Mat<typename parent::elem_type>& A) const; + + arma_cold inline const std::string incompat_size_string(const Mat<typename parent::elem_type>& A) const; + + + private: + + subview_each_common(); + }; + + + + +template<typename parent, unsigned int mode> +class subview_each1 : public subview_each_common<parent, mode> + { + protected: + + arma_inline subview_each1(parent& in_p); + + + public: + + typedef typename parent::elem_type eT; + + inline ~subview_each1(); + + // deliberately returning void + template<typename T1> inline void operator= (const Base<eT,T1>& x); + template<typename T1> inline void operator+= (const Base<eT,T1>& x); + template<typename T1> inline void operator-= (const Base<eT,T1>& x); + template<typename T1> inline void operator%= (const Base<eT,T1>& x); + template<typename T1> inline void operator/= (const Base<eT,T1>& x); + + + private: + + friend class Mat<eT>; + friend class subview<eT>; + + subview_each1(); + }; + + + +template<typename parent, unsigned int mode, typename TB> +class subview_each2 : public subview_each_common<parent, mode> + { + protected: + + const Base<uword, TB>& base_indices; + + inline subview_each2(parent& in_p, const Base<uword, TB>& in_indices); + + inline void check_indices(const Mat<uword>& indices) const; + + + public: + + typedef typename parent::elem_type eT; + + inline ~subview_each2(); + + // deliberately returning void + template<typename T1> inline void operator= (const Base<eT,T1>& x); + template<typename T1> inline void operator+= (const Base<eT,T1>& x); + template<typename T1> inline void operator-= (const Base<eT,T1>& x); + template<typename T1> inline void operator%= (const Base<eT,T1>& x); + template<typename T1> inline void operator/= (const Base<eT,T1>& x); + + // TODO: add handling of scalars + + + private: + + friend class Mat<eT>; + friend class subview<eT>; + + subview_each2(); + }; + + + +//! @}