// Copyright (C) 2008-2015 National ICT Australia (NICTA) // // 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/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup Base //! @{ template arma_inline const derived& Base::get_ref() const { return static_cast(*this); } template inline void Base::print(const std::string extra_text) const { if(is_op_strans::value || is_op_htrans::value) { const Proxy P( (*this).get_ref() ); const quasi_unwrap< typename Proxy::stored_type > tmp(P.Q); tmp.M.impl_print(extra_text); } else { const quasi_unwrap tmp( (*this).get_ref() ); tmp.M.impl_print(extra_text); } } template inline void Base::print(std::ostream& user_stream, const std::string extra_text) const { if(is_op_strans::value || is_op_htrans::value) { const Proxy P( (*this).get_ref() ); const quasi_unwrap< typename Proxy::stored_type > tmp(P.Q); tmp.M.impl_print(user_stream, extra_text); } else { const quasi_unwrap tmp( (*this).get_ref() ); tmp.M.impl_print(user_stream, extra_text); } } template inline void Base::raw_print(const std::string extra_text) const { if(is_op_strans::value || is_op_htrans::value) { const Proxy P( (*this).get_ref() ); const quasi_unwrap< typename Proxy::stored_type > tmp(P.Q); tmp.M.impl_raw_print(extra_text); } else { const quasi_unwrap tmp( (*this).get_ref() ); tmp.M.impl_raw_print(extra_text); } } template inline void Base::raw_print(std::ostream& user_stream, const std::string extra_text) const { if(is_op_strans::value || is_op_htrans::value) { const Proxy P( (*this).get_ref() ); const quasi_unwrap< typename Proxy::stored_type > tmp(P.Q); tmp.M.impl_raw_print(user_stream, extra_text); } else { const quasi_unwrap tmp( (*this).get_ref() ); tmp.M.impl_raw_print(user_stream, extra_text); } } template inline arma_warn_unused elem_type Base::min() const { return op_min::min( (*this).get_ref() ); } template inline arma_warn_unused elem_type Base::max() const { return op_max::max( (*this).get_ref() ); } template inline elem_type Base::min(uword& index_of_min_val) const { const Proxy P( (*this).get_ref() ); return op_min::min_with_index(P, index_of_min_val); } template inline elem_type Base::max(uword& index_of_max_val) const { const Proxy P( (*this).get_ref() ); return op_max::max_with_index(P, index_of_max_val); } template inline elem_type Base::min(uword& row_of_min_val, uword& col_of_min_val) const { const Proxy P( (*this).get_ref() ); uword index; const elem_type val = op_min::min_with_index(P, index); const uword local_n_rows = P.get_n_rows(); row_of_min_val = index % local_n_rows; col_of_min_val = index / local_n_rows; return val; } template inline elem_type Base::max(uword& row_of_max_val, uword& col_of_max_val) const { const Proxy P( (*this).get_ref() ); uword index; const elem_type val = op_max::max_with_index(P, index); const uword local_n_rows = P.get_n_rows(); row_of_max_val = index % local_n_rows; col_of_max_val = index / local_n_rows; return val; } // // extra functions defined in Base_inv_yes template arma_inline const Op Base_inv_yes::i() const { return Op(static_cast(*this)); } template arma_inline const Op Base_inv_yes::i(const bool) const // argument kept only for compatibility with old user code { return Op(static_cast(*this)); } template arma_inline const Op Base_inv_yes::i(const char*) const // argument kept only for compatibility with old user code { return Op(static_cast(*this)); } // // extra functions defined in Base_eval_Mat template arma_inline const derived& Base_eval_Mat::eval() const { arma_extra_debug_sigprint(); return static_cast(*this); } // // extra functions defined in Base_eval_expr template arma_inline Mat Base_eval_expr::eval() const { arma_extra_debug_sigprint(); return Mat( static_cast(*this) ); } // // extra functions defined in Base_trans_cx template arma_inline const Op Base_trans_cx::t() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_cx::ht() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_cx::st() const { return Op( static_cast(*this) ); } // // extra functions defined in Base_trans_default template arma_inline const Op Base_trans_default::t() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_default::ht() const { return Op( static_cast(*this) ); } template arma_inline const Op Base_trans_default::st() const { return Op( static_cast(*this) ); } //! @}