Bridge++  Ver. 2.0.2
decompose_LU_Cmplx.h
Go to the documentation of this file.
1 
14 #ifndef DECOMPOSE_LU_CMPLX_INCLUDED
15 #define DECOMPOSE_LU_CMPLX_INCLUDED
16 
17 #include <cfloat>
18 #include <cmath>
19 #include <valarray>
20 
21 #include "bridge_complex.h"
22 
23 #include "IO/bridgeIO.h"
24 
26 {
27  public:
28  Decompose_LU_Cmplx(size_t N) : N(N), N2(2 * N), size(N * N2), m_lu(size) {}
29 
30  void set_matrix(const double *mat);
31 
32  // solve Ax = b: vec -> A^{-1} vec
33  void solve(double *vec);
34 
35  // M -> A^{-1}
36  void get_inverse(double *mat_inv);
37 
38  // M -> A^{-1} * M
39  void mult_inverse(double *mat);
40 
41  // return det(A)
42  dcomplex determinant();
43 
44  private:
45  int N;
46  int N2;
47  int size;
48  std::valarray<double> m_lu;
49 
50  inline size_t re(int i, int j)
51  {
52  return N2 * i + 2 * j;
53  }
54 
55  inline size_t im(int i, int j)
56  {
57  return N2 * i + 2 * j + 1;
58  }
59 
60  inline size_t re(int i)
61  {
62  return 2 * i;
63  }
64 
65  inline size_t im(int i)
66  {
67  return 2 * i + 1;
68  }
69 };
70 #endif
bridgeIO.h
Decompose_LU_Cmplx::determinant
dcomplex determinant()
Definition: decompose_LU_Cmplx.cpp:128
Decompose_LU_Cmplx::im
size_t im(int i)
Definition: decompose_LU_Cmplx.h:65
Decompose_LU_Cmplx::re
size_t re(int i, int j)
Definition: decompose_LU_Cmplx.h:50
Decompose_LU_Cmplx::re
size_t re(int i)
Definition: decompose_LU_Cmplx.h:60
Decompose_LU_Cmplx::set_matrix
void set_matrix(const double *mat)
Definition: decompose_LU_Cmplx.cpp:17
Decompose_LU_Cmplx::N2
int N2
Definition: decompose_LU_Cmplx.h:46
Decompose_LU_Cmplx::size
int size
Definition: decompose_LU_Cmplx.h:47
bridge_complex.h
Decompose_LU_Cmplx::m_lu
std::valarray< double > m_lu
Definition: decompose_LU_Cmplx.h:48
Decompose_LU_Cmplx::Decompose_LU_Cmplx
Decompose_LU_Cmplx(size_t N)
Definition: decompose_LU_Cmplx.h:28
Decompose_LU_Cmplx::get_inverse
void get_inverse(double *mat_inv)
Definition: decompose_LU_Cmplx.cpp:77
Decompose_LU_Cmplx::solve
void solve(double *vec)
Definition: decompose_LU_Cmplx.cpp:51
Decompose_LU_Cmplx::im
size_t im(int i, int j)
Definition: decompose_LU_Cmplx.h:55
Decompose_LU_Cmplx
Definition: decompose_LU_Cmplx.h:25
Decompose_LU_Cmplx::mult_inverse
void mult_inverse(double *mat)
Definition: decompose_LU_Cmplx.cpp:91
Decompose_LU_Cmplx::N
int N
Definition: decompose_LU_Cmplx.h:45