max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 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_htrans max@0: //! @{ max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: void max@0: op_htrans::apply_noalias(Mat& out, const Mat& A, const typename arma_not_cx::result* junk) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(junk); max@0: max@0: op_strans::apply_noalias(out, A); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_htrans::apply_noalias(Mat& out, const Mat& A, const typename arma_cx_only::result* junk) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(junk); max@0: max@0: const uword A_n_rows = A.n_rows; max@0: const uword A_n_cols = A.n_cols; max@0: max@0: out.set_size(A_n_cols, A_n_rows); max@0: max@0: for(uword in_row = 0; in_row < A_n_rows; ++in_row) max@0: { max@0: const uword out_col = in_row; max@0: max@0: for(uword in_col = 0; in_col < A_n_cols; ++in_col) max@0: { max@0: const uword out_row = in_col; max@0: out.at(out_row, out_col) = std::conj( A.at(in_row, in_col) ); max@0: } max@0: } max@0: max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: void max@0: op_htrans::apply(Mat& out, const Mat& A, const typename arma_not_cx::result* junk) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(junk); max@0: max@0: op_strans::apply(out, A); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_htrans::apply(Mat& out, const Mat& A, const typename arma_cx_only::result* junk) max@0: { max@0: arma_extra_debug_sigprint(); max@0: arma_ignore(junk); max@0: max@0: if(&out != &A) max@0: { max@0: op_htrans::apply_noalias(out, A); max@0: } max@0: else max@0: { max@0: if(out.n_rows == out.n_cols) max@0: { max@0: arma_extra_debug_print("doing in-place hermitian transpose of a square matrix"); max@0: max@0: const uword n_rows = out.n_rows; max@0: const uword n_cols = out.n_cols; max@0: max@0: for(uword col=0; col tmp; max@0: op_strans::apply_noalias(tmp, A); max@0: max@0: out.steal_mem(tmp); 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_htrans::apply(Mat& out, const Op& in) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: const unwrap tmp(in.m); max@0: const Mat& A = tmp.M; max@0: max@0: op_htrans::apply(out, A); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_htrans::apply(Mat& out, const Op< Op, op_htrans>& in) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: const unwrap tmp(in.m.m); max@0: const Mat& A = tmp.M; max@0: max@0: const bool upper = in.m.aux_uword_a; max@0: max@0: op_trimat::apply_htrans(out, A, upper); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: op_htrans2::apply(Mat& out, const Op& in) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: typedef typename T1::elem_type eT; max@0: max@0: const unwrap tmp(in.m); max@0: max@0: op_htrans::apply(out, tmp.M); max@0: max@0: arrayops::inplace_mul( out.memptr(), in.aux, out.n_elem ); max@0: } max@0: max@0: max@0: max@0: //! @}