1 // SPDX-License-Identifier: Apache-2.0 2 // 3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) 4 // Copyright 2008-2016 National ICT Australia (NICTA) 5 // 6 // Licensed under the Apache License, Version 2.0 (the "License"); 7 // you may not use this file except in compliance with the License. 8 // You may obtain a copy of the License at 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // ------------------------------------------------------------------------ 17 18 19 //! \addtogroup op_min 20 //! @{ 21 22 23 class op_min 24 : public traits_op_xvec 25 { 26 public: 27 28 // 29 // dense matrices 30 31 template<typename T1> 32 inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_min>& in); 33 34 template<typename eT> 35 inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& X, const uword dim, const typename arma_not_cx<eT>::result* junk = nullptr); 36 37 template<typename eT> 38 inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& X, const uword dim, const typename arma_cx_only<eT>::result* junk = nullptr); 39 40 41 // 42 // cubes 43 44 template<typename T1> 45 inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_min>& in); 46 47 template<typename eT> 48 inline static void apply_noalias(Cube<eT>& out, const Cube<eT>& X, const uword dim, const typename arma_not_cx<eT>::result* junk = nullptr); 49 50 template<typename eT> 51 inline static void apply_noalias(Cube<eT>& out, const Cube<eT>& X, const uword dim, const typename arma_cx_only<eT>::result* junk = nullptr); 52 53 54 // 55 // for non-complex numbers 56 57 template<typename eT> 58 inline static eT direct_min(const eT* const X, const uword N); 59 60 template<typename eT> 61 inline static eT direct_min(const eT* const X, const uword N, uword& index_of_min_val); 62 63 template<typename eT> 64 inline static eT direct_min(const Mat<eT>& X, const uword row); 65 66 template<typename eT> 67 inline static eT min(const subview<eT>& X); 68 69 template<typename T1> 70 inline static typename arma_not_cx<typename T1::elem_type>::result min(const Base<typename T1::elem_type, T1>& X); 71 72 template<typename T1> 73 inline static typename arma_not_cx<typename T1::elem_type>::result min(const BaseCube<typename T1::elem_type, T1>& X); 74 75 template<typename T1> 76 inline static typename arma_not_cx<typename T1::elem_type>::result min_with_index(const Proxy<T1>& P, uword& index_of_min_val); 77 78 template<typename T1> 79 inline static typename arma_not_cx<typename T1::elem_type>::result min_with_index(const ProxyCube<T1>& P, uword& index_of_min_val); 80 81 82 // 83 // for complex numbers 84 85 template<typename T> 86 inline static std::complex<T> direct_min(const std::complex<T>* const X, const uword n_elem); 87 88 template<typename T> 89 inline static std::complex<T> direct_min(const std::complex<T>* const X, const uword n_elem, uword& index_of_min_val); 90 91 template<typename T> 92 inline static std::complex<T> direct_min(const Mat< std::complex<T> >& X, const uword row); 93 94 template<typename T> 95 inline static std::complex<T> min(const subview< std::complex<T> >& X); 96 97 template<typename T1> 98 inline static typename arma_cx_only<typename T1::elem_type>::result min(const Base<typename T1::elem_type, T1>& X); 99 100 template<typename T1> 101 inline static typename arma_cx_only<typename T1::elem_type>::result min(const BaseCube<typename T1::elem_type, T1>& X); 102 103 template<typename T1> 104 inline static typename arma_cx_only<typename T1::elem_type>::result min_with_index(const Proxy<T1>& P, uword& index_of_min_val); 105 106 template<typename T1> 107 inline static typename arma_cx_only<typename T1::elem_type>::result min_with_index(const ProxyCube<T1>& P, uword& index_of_min_val); 108 }; 109 110 111 112 //! @} 113