Bayeux  3.4.1
Core Foundation library for SuperNEMO
linear_system_solver.h
Go to the documentation of this file.
1 
3 #ifndef MYGSL_LINEAR_SYSTEM_SOLVER_H
4 #define MYGSL_LINEAR_SYSTEM_SOLVER_H 1
5 
6 // Standard library:
7 #include <iostream>
8 #include <vector>
9 
10 // Third party:
11 // - GSL:
12 #include <gsl/gsl_histogram.h>
13 #include <gsl/gsl_vector.h>
14 #include <gsl/gsl_linalg.h>
15 #include <gsl/gsl_errno.h>
16 
17 /*
18  * Solve: A.X = B
19  *
20  * ( a00 a10 a20 )
21  * A = ( a01 a11 a21 )
22  * ( a02 a12 a22 )
23  *
24  * ( b0 )
25  * B = ( b1 )
26  * ( b2 )
27  *
28  * ( x0 )
29  * X = ( x1 )
30  * ( x2 )
31  *
32  */
33 
34 namespace mygsl {
35 
38  {
39  public:
40 
41  bool is_initialized () const;
42 
43  size_t get_dimension () const;
44 
45  linear_system_solver (size_t dimension_ = 0);
46 
47  virtual ~linear_system_solver ();
48 
49  int solve (const std::vector<double> & a_,
50  const std::vector<double> & b_,
51  std::vector<double> & x_);
52 
53  private:
54 
55  void _reset_ ();
56 
57  void _init_ (size_t dimension_);
58 
59  private:
60 
61  size_t _dimension_;
62  //bool _use_gsl_vector_;
63  std::vector<double> _va_;
64  std::vector<double> _vb_;
65  gsl_vector * _vva_;
66  gsl_vector * _vvb_;
67  gsl_matrix_view _m_;
68  gsl_vector_view _b_;
69  gsl_permutation * _p_;
70  gsl_vector * _x_;
71 
72  };
73 
74  /* Solve:
75  *
76  * a1 x + b1 y = c1
77  * a2 x + b2 y = c2
78  *
79  */
80  bool linear_system_2x2_solve (double a1_, double b1_, double c1_,
81  double a2_, double b2_, double c2_,
82  double & x_, double & y_);
83 
84 } // end of namespace mygsl
85 
86 #endif // MYGSL_LINEAR_SYSTEM_SOLVER_H
87 
88 /* Local Variables: */
89 /* mode: c++ */
90 /* coding: utf-8 */
91 /* End: */
brief Linear system solver algorithm
Definition: linear_system_solver.h:37
bool linear_system_2x2_solve(double a1_, double b1_, double c1_, double a2_, double b2_, double c2_, double &x_, double &y_)
size_t get_dimension() const
linear_system_solver(size_t dimension_=0)
int solve(const std::vector< double > &a_, const std::vector< double > &b_, std::vector< double > &x_)
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47