source: mmcs/armadillo_bits/xvec_htrans_meat.hpp @ 8daa049

matrices
Last change on this file since 8daa049 was 9dd61b1, checked in by rboet <rboet@…>, 9 years ago

Avance del proyecto 60%

  • Property mode set to 100644
File size: 1.6 KB
Line 
1// Copyright (C) 2013 Conrad Sanderson
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
8//! \addtogroup xvec_htrans
9//! @{
10
11
12template<typename eT>
13inline
14xvec_htrans<eT>::xvec_htrans(const eT* const in_mem, const uword in_n_rows, const uword in_n_cols)
15  : mem   (in_mem             )
16  , n_rows(in_n_cols          )  // deliberately swapped
17  , n_cols(in_n_rows          )
18  , n_elem(in_n_rows*in_n_cols)
19  {
20  arma_extra_debug_sigprint();
21  }
22
23
24
25template<typename eT>
26inline
27void
28xvec_htrans<eT>::extract(Mat<eT>& out) const
29  {
30  arma_extra_debug_sigprint();
31 
32  // NOTE: this function assumes that matrix 'out' has already been set to the correct size
33 
34  const eT*  in_mem = mem;
35        eT* out_mem = out.memptr();
36 
37  const uword N = n_elem;
38 
39  for(uword ii=0; ii < N; ++ii)
40    {
41    out_mem[ii] = access::alt_conj( in_mem[ii] );
42    }
43  }
44
45
46
47template<typename eT>
48inline
49eT
50xvec_htrans<eT>::operator[](const uword ii) const
51  {
52  return access::alt_conj( mem[ii] );
53  }
54
55
56
57template<typename eT>
58inline
59eT
60xvec_htrans<eT>::at_alt(const uword ii) const
61  {
62  return access::alt_conj( mem[ii] );
63  }
64
65
66
67template<typename eT>
68inline
69eT
70xvec_htrans<eT>::at(const uword in_row, const uword in_col) const
71  {
72  //return (n_rows == 1) ? access::alt_conj( mem[in_col] ) : access::alt_conj( mem[in_row] );
73 
74  return access::alt_conj( mem[in_row + in_col] );  // either in_row or in_col must be zero, as we're storing a vector
75  }
76
77
78
79//! @}
Note: See TracBrowser for help on using the repository browser.