Hex  2.2
Hydrogen-electron collision solver
lu-lapack.h
Go to the documentation of this file.
1 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
2 // //
3 // / / / / __ \ \ / / //
4 // / /__ / / / _ \ \ \/ / //
5 // / ___ / | |/_/ / /\ \ //
6 // / / / / \_\ / / \ \ //
7 // //
8 // //
9 // Copyright (c) 2016, Jakub Benda, Charles University in Prague //
10 // //
11 // MIT License: //
12 // //
13 // Permission is hereby granted, free of charge, to any person obtaining a //
14 // copy of this software and associated documentation files (the "Software"), //
15 // to deal in the Software without restriction, including without limitation //
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense, //
17 // and/or sell copies of the Software, and to permit persons to whom the //
18 // Software is furnished to do so, subject to the following conditions: //
19 // //
20 // The above copyright notice and this permission notice shall be included //
21 // in all copies or substantial portions of the Software. //
22 // //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS //
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
26 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, //
27 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF //
28 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //
29 // //
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 #ifndef HEX_LU_LAPACK_H
33 #define HEX_LU_LAPACK_H
34 
35 // --------------------------------------------------------------------------------- //
36 
37 #include "hex-csrmatrix.h"
38 
39 // --------------------------------------------------------------------------------- //
40 
41 #include "luft.h"
42 
43 // --------------------------------------------------------------------------------- //
44 
50 class LUft_LAPACK : public LUft
51 {
52  public:
53 
54  // run-time selection mechanism
56 
57 
58  LUft_LAPACK ();
59 
61  virtual ~LUft_LAPACK();
62 
63  // Disable bitwise copy
64  LUft_LAPACK const & operator= (LUft_LAPACK const &) = delete;
65 
67  virtual void factorize (CsrMatrix<LU_int_t,Complex> const & matrix, LUftData data);
68 
70  virtual bool valid () const { return size() != 0; }
71 
73  virtual std::size_t size () const;
74 
76  virtual void solve (const cArrayView b, cArrayView x, int eqs) const;
77 
79  virtual void save (std::string name) const;
80 
82  virtual void load (std::string name, bool throw_on_io_failure = true);
83 
85  virtual void drop ();
86 
87  private:
88 
90  NumberArray<LU_int_t> R_;
91 
93  cArray LU_;
94 
96  NumberArray<blas::Int> ipiv_;
97 
99  blas::Int n_;
100 
102  blas::Int k_;
103 };
104 
105 // --------------------------------------------------------------------------------- //
106 
107 #endif // HEX_LU_LAPACK_H
factorizerRunTimeSelectionDefinitions(LUft_LAPACK, "lapack") LUft_LAPACK()
Default constructor.
virtual bool valid() const
Validity indicator.
Definition: lu-lapack.h:70
LU factorization object.
Definition: luft.h:74
Definition: luft.h:42
virtual ~LUft_LAPACK()
Destructor.
Definition: lu-lapack.cpp:153
virtual void solve(const cArrayView b, cArrayView x, int eqs) const
Solve equations.
Definition: lu-lapack.cpp:208
LU factorization using LAPACK.
Definition: lu-lapack.h:50
virtual void save() const
Definition: luft.h:181
virtual void load()
Definition: luft.h:187
virtual void factorize(CsrMatrix< LU_int_t, Complex > const &matrix, LUftData data)
Factorize.
Definition: lu-lapack.cpp:158
Definition: luft.h:46
virtual std::size_t size() const
Return LU byte size.
Definition: lu-lapack.cpp:234
virtual void drop()
Release memory.
Definition: lu-lapack.cpp:146
LUft_LAPACK const & operator=(LUft_LAPACK const &)=delete