max@0: // Copyright (C) 2009-2012 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2009-2012 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup op_relational max@0: //! @{ max@0: max@0: max@0: #undef operator_rel max@0: max@0: #undef arma_applier_mat_pre max@0: #undef arma_applier_mat_post max@0: max@0: #undef arma_applier_cube_pre max@0: #undef arma_applier_cube_post max@0: max@0: max@0: #define arma_applier_mat_pre(operator_rel) \ max@0: {\ max@0: typedef typename T1::elem_type eT;\ max@0: typedef typename Proxy::ea_type ea_type;\ max@0: \ max@0: const eT val = X.aux;\ max@0: \ max@0: const Proxy P(X.m);\ max@0: \ max@0: const uword n_rows = P.get_n_rows();\ max@0: const uword n_cols = P.get_n_cols();\ max@0: \ max@0: const bool bad_alias = ( Proxy::has_subview && P.is_alias(out) );\ max@0: \ max@0: if(bad_alias == false)\ max@0: {\ max@0: out.set_size(n_rows, n_cols);\ max@0: \ max@0: uword* out_mem = out.memptr();\ max@0: \ max@0: if(Proxy::prefer_at_accessor == false)\ max@0: {\ max@0: ea_type PA = P.get_ea();\ max@0: const uword n_elem = out.n_elem;\ max@0: \ max@0: for(uword i=0; i::stored_type> tmp(P.Q);\ max@0: \ max@0: out = (val) operator_rel (tmp.M);\ max@0: }\ max@0: } max@0: max@0: max@0: max@0: #define arma_applier_mat_post(operator_rel) \ max@0: {\ max@0: typedef typename T1::elem_type eT;\ max@0: typedef typename Proxy::ea_type ea_type;\ max@0: \ max@0: const eT val = X.aux;\ max@0: \ max@0: const Proxy P(X.m);\ max@0: \ max@0: const uword n_rows = P.get_n_rows();\ max@0: const uword n_cols = P.get_n_cols();\ max@0: \ max@0: const bool bad_alias = ( Proxy::has_subview && P.is_alias(out) );\ max@0: \ max@0: if(bad_alias == false)\ max@0: {\ max@0: out.set_size(n_rows, n_cols);\ max@0: \ max@0: uword* out_mem = out.memptr();\ max@0: \ max@0: if(Proxy::prefer_at_accessor == false)\ max@0: {\ max@0: ea_type PA = P.get_ea();\ max@0: const uword n_elem = out.n_elem;\ max@0: \ max@0: for(uword i=0; i::stored_type> tmp(P.Q);\ max@0: \ max@0: out = (tmp.M) operator_rel (val);\ max@0: }\ max@0: } max@0: max@0: max@0: max@0: #define arma_applier_cube_pre(operator_rel) \ max@0: {\ max@0: typedef typename T1::elem_type eT;\ max@0: typedef typename ProxyCube::ea_type ea_type;\ max@0: \ max@0: const eT val = X.aux;\ max@0: \ max@0: const ProxyCube P(X.m);\ max@0: \ max@0: const uword n_rows = P.get_n_rows();\ max@0: const uword n_cols = P.get_n_cols();\ max@0: const uword n_slices = P.get_n_slices();\ max@0: \ max@0: const bool bad_alias = ( ProxyCube::has_subview && P.is_alias(out) );\ max@0: \ max@0: if(bad_alias == false)\ max@0: {\ max@0: out.set_size(n_rows, n_cols, n_slices);\ max@0: \ max@0: uword* out_mem = out.memptr();\ max@0: \ max@0: if(ProxyCube::prefer_at_accessor == false)\ max@0: {\ max@0: ea_type PA = P.get_ea();\ max@0: const uword n_elem = out.n_elem;\ max@0: \ max@0: for(uword i=0; i::stored_type> tmp(P.Q);\ max@0: \ max@0: out = (val) operator_rel (tmp.M);\ max@0: }\ max@0: } max@0: max@0: max@0: max@0: #define arma_applier_cube_post(operator_rel) \ max@0: {\ max@0: typedef typename T1::elem_type eT;\ max@0: typedef typename ProxyCube::ea_type ea_type;\ max@0: \ max@0: const eT val = X.aux;\ max@0: \ max@0: const ProxyCube P(X.m);\ max@0: \ max@0: const uword n_rows = P.get_n_rows();\ max@0: const uword n_cols = P.get_n_cols();\ max@0: const uword n_slices = P.get_n_slices();\ max@0: \ max@0: const bool bad_alias = ( ProxyCube::has_subview && P.is_alias(out) );\ max@0: \ max@0: if(bad_alias == false)\ max@0: {\ max@0: out.set_size(n_rows, n_cols, n_slices);\ max@0: \ max@0: uword* out_mem = out.memptr();\ max@0: \ max@0: if(ProxyCube::prefer_at_accessor == false)\ max@0: {\ max@0: ea_type PA = P.get_ea();\ max@0: const uword n_elem = out.n_elem;\ max@0: \ max@0: for(uword i=0; i::stored_type> tmp(P.Q);\ max@0: \ max@0: out = (tmp.M) operator_rel (val);\ max@0: }\ max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lt_pre::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_pre( < ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gt_pre::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_pre( > ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lteq_pre::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_pre( <= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gteq_pre::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_pre( >= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lt_post::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_post( < ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gt_post::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_post( > ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lteq_post::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_post( <= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gteq_post::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_post( >= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_eq::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_post( == ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_noteq::apply(Mat& out, const mtOp& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_mat_post( != ); max@0: } max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lt_pre::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_pre( < ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gt_pre::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_pre( > ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lteq_pre::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_pre( <= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gteq_pre::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_pre( >= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lt_post::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_post( < ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gt_post::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_post( > ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_lteq_post::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_post( <= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_gteq_post::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_post( >= ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_eq::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_post( == ); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_rel_noteq::apply(Cube& out, const mtOpCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_applier_cube_post( != ); max@0: } max@0: max@0: max@0: max@0: #undef arma_applier_mat_pre max@0: #undef arma_applier_mat_post max@0: max@0: #undef arma_applier_cube_pre max@0: #undef arma_applier_cube_post max@0: max@0: max@0: max@0: //! @}