Bridge++  Ver. 2.0.2
decompose_Hessenberg_Cmplx.h
Go to the documentation of this file.
1 
14 #ifndef DECOMPOSE_HESSENBERG_CMPLX_INCLUDED
15 #define DECOMPOSE_HESSENBERG_CMPLX_INCLUDED
16 
17 #include <cmath>
18 #include <cfloat>
19 #include <valarray>
20 
21 /*
22  Class for Hessenberg decomposition with Householder transformation
23  A -> H = Q^\dag A Q
24  The notation of Householder transformation is the same as that of GSL.
25  H = I - tau vv^\dag
26  H^\dag x = - |x| sign(Re(x_1)) e_1
27  */
28 
30  public:
31  Decompose_Hessenberg_Cmplx(const size_t& Nin) : N(Nin), N2(2 * N), size(N * N2),
32  m_H(size), m_tau(N2)
33  {
34  }
35 
36  void set_matrix(const double *mat);
37  void get_Hessenberg(double *mat);
38  void get_Q(double *mat);
39  void mult_Q(double *mat);
40 
41  private:
42  size_t N;
43  size_t N2;
44  size_t size;
45 
46  // store R and householder vector
47  std::valarray<double> m_H;
48  std::valarray<double> m_tau;
49 
50  // matrix index [i,j]
51  inline size_t re(const size_t i, const size_t j)
52  {
53  return N2 * i + 2 * j;
54  }
55 
56  inline size_t im(const size_t i, const size_t j)
57  {
58  return N2 * i + 2 * j + 1;
59  }
60 
61  // vector index [i]
62  inline size_t re(const size_t i)
63  {
64  return 2 * i;
65  }
66 
67  inline size_t im(const size_t i)
68  {
69  return 2 * i + 1;
70  }
71 };
72 #endif
Decompose_Hessenberg_Cmplx::set_matrix
void set_matrix(const double *mat)
Definition: decompose_Hessenberg_Cmplx.cpp:17
Decompose_Hessenberg_Cmplx::N2
size_t N2
Definition: decompose_Hessenberg_Cmplx.h:43
Decompose_Hessenberg_Cmplx::im
size_t im(const size_t i, const size_t j)
Definition: decompose_Hessenberg_Cmplx.h:56
Decompose_Hessenberg_Cmplx::get_Q
void get_Q(double *mat)
Definition: decompose_Hessenberg_Cmplx.cpp:144
Decompose_Hessenberg_Cmplx::m_H
std::valarray< double > m_H
Definition: decompose_Hessenberg_Cmplx.h:47
Decompose_Hessenberg_Cmplx::re
size_t re(const size_t i)
Definition: decompose_Hessenberg_Cmplx.h:62
Decompose_Hessenberg_Cmplx::Decompose_Hessenberg_Cmplx
Decompose_Hessenberg_Cmplx(const size_t &Nin)
Definition: decompose_Hessenberg_Cmplx.h:31
Decompose_Hessenberg_Cmplx::re
size_t re(const size_t i, const size_t j)
Definition: decompose_Hessenberg_Cmplx.h:51
Decompose_Hessenberg_Cmplx::size
size_t size
Definition: decompose_Hessenberg_Cmplx.h:44
Decompose_Hessenberg_Cmplx
Definition: decompose_Hessenberg_Cmplx.h:29
Decompose_Hessenberg_Cmplx::m_tau
std::valarray< double > m_tau
Definition: decompose_Hessenberg_Cmplx.h:48
Decompose_Hessenberg_Cmplx::get_Hessenberg
void get_Hessenberg(double *mat)
Definition: decompose_Hessenberg_Cmplx.cpp:130
Decompose_Hessenberg_Cmplx::im
size_t im(const size_t i)
Definition: decompose_Hessenberg_Cmplx.h:67
Decompose_Hessenberg_Cmplx::N
size_t N
Definition: decompose_Hessenberg_Cmplx.h:42
Decompose_Hessenberg_Cmplx::mult_Q
void mult_Q(double *mat)
Definition: decompose_Hessenberg_Cmplx.cpp:158