// Copyright (C) 2008-2014 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 SpBase //! @{ template arma_inline const derived& SpBase::get_ref() const { return static_cast(*this); } template inline const SpOp SpBase::t() const { return SpOp( (*this).get_ref() ); } template inline const SpOp SpBase::ht() const { return SpOp( (*this).get_ref() ); } template inline const SpOp SpBase::st() const { return SpOp( (*this).get_ref() ); } template inline void SpBase::print(const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_print(extra_text); } template inline void SpBase::print(std::ostream& user_stream, const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_print(user_stream, extra_text); } template inline void SpBase::raw_print(const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_raw_print(extra_text); } template inline void SpBase::raw_print(std::ostream& user_stream, const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_raw_print(user_stream, extra_text); } template inline void SpBase::print_dense(const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_print_dense(extra_text); } template inline void SpBase::print_dense(std::ostream& user_stream, const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_print_dense(user_stream, extra_text); } template inline void SpBase::raw_print_dense(const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_raw_print_dense(extra_text); } template inline void SpBase::raw_print_dense(std::ostream& user_stream, const std::string extra_text) const { const unwrap_spmat tmp( (*this).get_ref() ); tmp.M.impl_raw_print_dense(user_stream, extra_text); } // // extra functions defined in SpBase_eval_SpMat template inline const derived& SpBase_eval_SpMat::eval() const { arma_extra_debug_sigprint(); return static_cast(*this); } // // extra functions defined in SpBase_eval_expr template inline SpMat SpBase_eval_expr::eval() const { arma_extra_debug_sigprint(); return SpMat( static_cast(*this) ); } template inline arma_warn_unused elem_type SpBase::min() const { return spop_min::min( (*this).get_ref() ); } template inline arma_warn_unused elem_type SpBase::max() const { return spop_max::max( (*this).get_ref() ); } template inline elem_type SpBase::min(uword& index_of_min_val) const { const SpProxy P( (*this).get_ref() ); return spop_min::min_with_index(P, index_of_min_val); } template inline elem_type SpBase::max(uword& index_of_max_val) const { const SpProxy P( (*this).get_ref() ); return spop_max::max_with_index(P, index_of_max_val); } template inline elem_type SpBase::min(uword& row_of_min_val, uword& col_of_min_val) const { const SpProxy P( (*this).get_ref() ); uword index; const elem_type val = spop_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 SpBase::max(uword& row_of_max_val, uword& col_of_max_val) const { const SpProxy P( (*this).get_ref() ); uword index; const elem_type val = spop_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; } //! @}