MyraMath
ZLDLTSolver.h
Go to the documentation of this file.
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_DENSE_ZLDLTSOLVER_H
7 #define MYRAMATH_DENSE_ZLDLTSOLVER_H
8 
17 
18 #include <utility>
19 #include <vector>
20 #include <stdint.h> // for uint64_t
21 
22 namespace myra {
23 
24 // Forward declarations.
25 class InputStream;
26 class OutputStream;
27 template<class Number> class MatrixRange;
28 
30 template<class Precision> class MYRAMATH_EXPORT ZLDLTSolver
31  {
32  public:
33 
34  // Useful typedefs.
35  typedef std::complex<Precision> Number;
36  typedef MatrixRange<Number> Range;
37 
39  explicit ZLDLTSolver(const LowerMatrix<Number>& A);
40 
41 #ifdef MYRAMATH_ENABLE_CPP11
42  explicit ZLDLTSolver(LowerMatrix<Number>&& A);
44 #endif
45 
47  explicit ZLDLTSolver(LowerMatrix<Number>& A);
48 
50  explicit ZLDLTSolver(InputStream& in);
51 
53  void write(OutputStream& out) const;
54 
56  // side = Solve by A from the 'L'eft or from the 'R'ight?
57  // op = Apply an operation to A? ('T'ranspose, 'H'ermitian, 'C'onjugate or 'N'othing)
58  void solve(const Range& B, char side, char op) const;
59 
61  // side = Solve by L from the 'L'eft or from the 'R'ight?
62  // op = Apply an operation to L? ('T'ranspose, 'H'ermitian, 'C'onjugate or 'N'othing)
63  uint64_t solveL(const Range& B, char side, char op) const;
64 
66  void solveD(const Range& B, char side) const;
67 
69  std::pair<int,int> inertia() const;
70 
72  int size() const;
73 
74  private:
75 
76  // Implementation details for factorization.
77  void constructor_detail();
78 
79  // Holds number data L.
81 
82  // For applying permutation P.
83  std::vector<int> P_swaps;
84 
85  // For applying permutation Q.
86  std::vector<int> Q_swaps;
87 
88  // For applying pivot rotations R.
90 
91  // Encodes inertia.
92  int n_plus;
93  int n_minus;
94 
95  };
96 
98 template<class Precision> class ReflectNumber <ZLDLTSolver<Precision> >
99  { public: typedef typename ZLDLTSolver<Precision>::Number type; };
100 
101 } // namespace
102 
103 #endif
Reflects Number trait for a Container, containers of Numbers (Matrix&#39;s, Vector&#39;s, etc) should special...
Definition: Number.h:55
Factors A = L*D*Lt, where D is a "sign matrix" of the form [I 0; 0 -I]. Presents solve methods...
Definition: ZLDLTSolver.h:30
A mostly-identity matrix type, with the occasional Matrix22 at a specific diagonal offset (n...
Definition: PivotMatrix.h:29
Definition: syntax.dox:1
Abstraction layer, serializable objects write themselves to these.
Definition: Streams.h:39
Specialized container for a lower triangular matrix, O(N^2/2) storage. Used by symmetry exploiting ma...
Various utility functions/classes related to scalar Number types.
Represents a mutable MatrixRange.
Definition: conjugate.h:26
Abstraction layer, deserializable objects read themselves from these.
Definition: Streams.h:47
A collection of pivot Matrix22&#39;s used within L*D*op(L)-factorizations (sytrf, hetrf).
Stores a lower triangular matrix in rectangular packed format.
Definition: conjugate.h:22