// Copyright (C) 2012-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 // Written by Ryan Curtin //! \addtogroup spop_htrans //! @{ template arma_hot inline void spop_htrans::apply(SpMat& out, const SpOp& in, const typename arma_not_cx::result* junk) { arma_extra_debug_sigprint(); arma_ignore(junk); spop_strans::apply(out, in); } template arma_hot inline void spop_htrans::apply(SpMat& out, const SpOp& in, const typename arma_cx_only::result* junk) { arma_extra_debug_sigprint(); arma_ignore(junk); typedef typename T1::elem_type eT; typedef typename umat::elem_type ueT; const SpProxy p(in.m); const uword N = p.get_n_nonzero(); if(N == uword(0)) { out.zeros(p.get_n_cols(), p.get_n_rows()); return; } umat locs(2, N); Col vals(N); eT* vals_ptr = vals.memptr(); typename SpProxy::const_iterator_type it = p.begin(); for(uword count = 0; count < N; ++count) { ueT* locs_ptr = locs.colptr(count); locs_ptr[0] = it.col(); locs_ptr[1] = it.row(); vals_ptr[count] = std::conj(*it); ++it; } SpMat tmp(locs, vals, p.get_n_cols(), p.get_n_rows()); out.steal_mem(tmp); } //! @}