// SPDX-License-Identifier: Apache-2.0 // // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) // Copyright 2008-2016 National ICT Australia (NICTA) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ //! \addtogroup glue_relational //! @{ #undef operator_rel #undef operator_str #undef arma_applier_mat #undef arma_applier_cube #define arma_applier_mat(operator_rel, operator_str) \ {\ const Proxy P1(X.A);\ const Proxy P2(X.B);\ \ arma_debug_assert_same_size(P1, P2, operator_str);\ \ const bool bad_alias = (Proxy::has_subview && P1.is_alias(out)) || (Proxy::has_subview && P2.is_alias(out));\ \ if(bad_alias == false)\ {\ \ const uword n_rows = P1.get_n_rows();\ const uword n_cols = P1.get_n_cols();\ \ out.set_size(n_rows, n_cols);\ \ uword* out_mem = out.memptr();\ \ const bool use_at = (Proxy::use_at || Proxy::use_at);\ \ if(use_at == false)\ {\ typename Proxy::ea_type A = P1.get_ea();\ typename Proxy::ea_type B = P2.get_ea();\ \ const uword n_elem = out.n_elem;\ \ for(uword i=0; i::stored_type> tmp1(P1.Q, P1.is_alias(out));\ const unwrap_check::stored_type> tmp2(P2.Q, P2.is_alias(out));\ \ out = (tmp1.M) operator_rel (tmp2.M);\ }\ } #define arma_applier_cube(operator_rel, operator_str) \ {\ const ProxyCube P1(X.A);\ const ProxyCube P2(X.B);\ \ arma_debug_assert_same_size(P1, P2, operator_str);\ \ const bool bad_alias = (ProxyCube::has_subview && P1.is_alias(out)) || (ProxyCube::has_subview && P2.is_alias(out));\ \ if(bad_alias == false)\ {\ \ const uword n_rows = P1.get_n_rows();\ const uword n_cols = P1.get_n_cols();\ const uword n_slices = P1.get_n_slices();\ \ out.set_size(n_rows, n_cols, n_slices);\ \ uword* out_mem = out.memptr();\ \ const bool use_at = (ProxyCube::use_at || ProxyCube::use_at);\ \ if(use_at == false)\ {\ typename ProxyCube::ea_type A = P1.get_ea();\ typename ProxyCube::ea_type B = P2.get_ea();\ \ const uword n_elem = out.n_elem;\ \ for(uword i=0; i::stored_type> tmp1(P1.Q);\ const unwrap_cube::stored_type> tmp2(P2.Q);\ \ out = (tmp1.M) operator_rel (tmp2.M);\ }\ } template inline void glue_rel_lt::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(<, "operator<"); } template inline void glue_rel_gt::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(>, "operator>"); } template inline void glue_rel_lteq::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(<=, "operator<="); } template inline void glue_rel_gteq::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(>=, "operator>="); } template inline void glue_rel_eq::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(==, "operator=="); } template inline void glue_rel_noteq::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(!=, "operator!="); } template inline void glue_rel_and::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(&&, "operator&&"); } template inline void glue_rel_or::apply ( Mat & out, const mtGlue& X ) { arma_extra_debug_sigprint(); arma_applier_mat(||, "operator||"); } // // // template inline void glue_rel_lt::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(<, "operator<"); } template inline void glue_rel_gt::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(>, "operator>"); } template inline void glue_rel_lteq::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(<=, "operator<="); } template inline void glue_rel_gteq::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(>=, "operator>="); } template inline void glue_rel_eq::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(==, "operator=="); } template inline void glue_rel_noteq::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(!=, "operator!="); } template inline void glue_rel_and::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(&&, "operator&&"); } template inline void glue_rel_or::apply ( Cube & out, const mtGlueCube& X ) { arma_extra_debug_sigprint(); arma_applier_cube(||, "operator||"); } #undef arma_applier_mat #undef arma_applier_cube //! @}