op_htrans_meat.hpp
Go to the documentation of this file.
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2011 Conrad Sanderson
3 //
4 // This file is part of the Armadillo C++ library.
5 // It is provided without any warranty of fitness
6 // for any purpose. You can redistribute this file
7 // and/or modify it under the terms of the GNU
8 // Lesser General Public License (LGPL) as published
9 // by the Free Software Foundation, either version 3
10 // of the License or (at your option) any later version.
11 // (see http://www.opensource.org/licenses for more info)
12 
13 
16 
17 
18 
19 template<typename eT>
21 void
23  {
25  arma_ignore(junk);
26 
28  }
29 
30 
31 
32 template<typename eT>
33 inline
34 void
36  {
38  arma_ignore(junk);
39 
40  const uword A_n_rows = A.n_rows;
41  const uword A_n_cols = A.n_cols;
42 
43  out.set_size(A_n_cols, A_n_rows);
44 
45  for(uword in_row = 0; in_row < A_n_rows; ++in_row)
46  {
47  const uword out_col = in_row;
48 
49  for(uword in_col = 0; in_col < A_n_cols; ++in_col)
50  {
51  const uword out_row = in_col;
52  out.at(out_row, out_col) = std::conj( A.at(in_row, in_col) );
53  }
54  }
55 
56  }
57 
58 
59 
60 template<typename eT>
62 void
64  {
66  arma_ignore(junk);
67 
68  op_strans::apply(out, A);
69  }
70 
71 
72 
73 template<typename eT>
74 inline
75 void
77  {
79  arma_ignore(junk);
80 
81  if(&out != &A)
82  {
84  }
85  else
86  {
87  if(out.n_rows == out.n_cols)
88  {
89  arma_extra_debug_print("doing in-place hermitian transpose of a square matrix");
90 
91  const uword n_rows = out.n_rows;
92  const uword n_cols = out.n_cols;
93 
94  for(uword col=0; col<n_cols; ++col)
95  {
96  eT* coldata = out.colptr(col);
97 
98  out.at(col,col) = std::conj( out.at(col,col) );
99 
100  for(uword row=(col+1); row<n_rows; ++row)
101  {
102  const eT val1 = std::conj(coldata[row]);
103  const eT val2 = std::conj(out.at(col,row));
104 
105  out.at(col,row) = val1;
106  coldata[row] = val2;
107  }
108  }
109  }
110  else
111  {
112  Mat<eT> tmp;
113  op_strans::apply_noalias(tmp, A);
114 
115  out.steal_mem(tmp);
116  }
117  }
118 
119  }
120 
121 
122 
123 template<typename T1>
124 inline
125 void
127  {
129 
130  typedef typename T1::elem_type eT;
131 
132  const unwrap<T1> tmp(in.m);
133  const Mat<eT>& A = tmp.M;
134 
135  op_htrans::apply(out, A);
136  }
137 
138 
139 
140 template<typename T1>
141 inline
142 void
144  {
146 
147  typedef typename T1::elem_type eT;
148 
149  const unwrap<T1> tmp(in.m.m);
150  const Mat<eT>& A = tmp.M;
151 
152  const bool upper = in.m.aux_uword_a;
153 
154  op_trimat::apply_htrans(out, A, upper);
155  }
156 
157 
158 
159 template<typename T1>
160 inline
161 void
163  {
165 
166  typedef typename T1::elem_type eT;
167 
168  const unwrap<T1> tmp(in.m);
169 
170  op_htrans::apply(out, tmp.M);
171 
172  arrayops::inplace_mul( out.memptr(), in.aux, out.n_elem );
173  }
174 
175 
176 
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
Definition: Mat_meat.hpp:4024
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
Definition: Mat_meat.hpp:4211
void steal_mem(Mat &X)
Definition: Mat_meat.hpp:630
static arma_hot void inplace_mul(eT *dest, const eT *src, const uword n_elem)
static arma_inline void apply(Mat< eT > &out, const Mat< eT > &A, const typename arma_not_cx< eT >::result *junk=0)
static void apply(Mat< eT > &out, const Mat< eT > &A)
const uword n_cols
number of columns in the matrix (read-only)
Definition: Mat_bones.hpp:30
arma_inline const T1 & conj(const Base< typename T1::pod_type, T1 > &A)
Definition: fn_elem.hpp:430
const uword n_elem
number of elements in the matrix (read-only)
Definition: Mat_bones.hpp:31
const uword n_rows
number of rows in the matrix (read-only)
Definition: Mat_bones.hpp:29
#define arma_extra_debug_print
Definition: debug.hpp:1118
arma_aligned elem_type aux
storage of auxiliary data, user defined format
Definition: Op_bones.hpp:46
arma_aligned const T1 & m
storage of reference to the operand (eg. a matrix)
Definition: Op_bones.hpp:45
arma_inline arma_warn_unused eT * colptr(const uword in_col)
returns a pointer to array of eTs for a specified column; no bounds check
Definition: Mat_meat.hpp:4000
u32 uword
Definition: typedef.hpp:85
const Mat< eT > M
Definition: unwrap.hpp:32
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
Definition: Mat_meat.hpp:3692
#define arma_ignore(variable)
static arma_inline void apply_noalias(Mat< eT > &out, const Mat< eT > &A, const typename arma_not_cx< eT >::result *junk=0)
&#39;hermitian transpose&#39; operation
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
static void apply_htrans(Mat< eT > &out, const Mat< eT > &A, const bool upper, const typename arma_not_cx< eT >::result *junk=0)
static void apply(Mat< typename T1::elem_type > &out, const Op< T1, op_htrans2 > &in)
Dense matrix class.
#define arma_inline
static void apply_noalias(Mat< eT > &out, const Mat< eT > &A)
Immediate transpose of a dense matrix.


armadillo_matrix
Author(s):
autogenerated on Fri Apr 16 2021 02:31:58