Chris@49: // Copyright (C) 2009-2012 NICTA (www.nicta.com.au) Chris@49: // Copyright (C) 2009-2012 Conrad Sanderson Chris@49: // Copyright (C) 2009-2010 Dimitrios Bouzas Chris@49: // Chris@49: // This Source Code Form is subject to the terms of the Mozilla Public Chris@49: // License, v. 2.0. If a copy of the MPL was not distributed with this Chris@49: // file, You can obtain one at http://mozilla.org/MPL/2.0/. Chris@49: Chris@49: Chris@49: Chris@49: //! \addtogroup op_shuffle Chris@49: //! @{ Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: inline Chris@49: void Chris@49: op_shuffle::apply(Mat& out, const Op& in) Chris@49: { Chris@49: arma_extra_debug_sigprint(); Chris@49: Chris@49: typedef typename T1::elem_type eT; Chris@49: Chris@49: const unwrap tmp(in.m); Chris@49: const Mat& X = tmp.M; Chris@49: Chris@49: if(X.is_empty()) { out.copy_size(X); return; } Chris@49: Chris@49: const uword dim = in.aux_uword_a; Chris@49: const uword N = (dim == 0) ? X.n_rows : X.n_cols; Chris@49: Chris@49: // see "fn_sort_index.hpp" for the definition of "arma_sort_index_packet" Chris@49: // and the associated comparison functor Chris@49: std::vector< arma_sort_index_packet > packet_vec(N); Chris@49: Chris@49: for(uword i=0; i 1) // i.e. column vector Chris@49: { Chris@49: for(uword i=0; i 1) // i.e. row vector Chris@49: { Chris@49: for(uword i=0; i 1) // i.e. column vector Chris@49: { Chris@49: for(uword i=0; i 1) // i.e. row vector Chris@49: { Chris@49: for(uword i=0; i