Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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(const size_t &Nin)
size_t re(const size_t i, const size_t j)
size_t im(const size_t i, const size_t j)