MyraMath
RLDLTSolver.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_RLDLTSOLVER_H
7 #define MYRAMATH_DENSE_RLDLTSOLVER_H
8 
17 
18 #include <utility>
19 #include <vector>
20 #include <stdint.h>
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 RLDLTSolver
31  {
32  public:
33 
34  // Useful typedefs.
36 
38  explicit RLDLTSolver(const LowerMatrix<Precision>& A);
39 
40 #ifdef MYRAMATH_ENABLE_CPP11
41  explicit RLDLTSolver(LowerMatrix<Precision>&& A);
43 #endif
44 
47 
49  explicit RLDLTSolver(InputStream& in);
50 
52  void write(OutputStream& out) const;
53 
55  // side = Solve by A from the 'L'eft or from the 'R'ight?
56  // op = Apply an operation to A? ('T'ranspose, 'H'ermitian, 'C'onjugate or 'N'othing)
57  void solve(const Range& B, char side = 'L', char op = 'N') const;
58 
60  // side = Solve by L from the 'L'eft or from the 'R'ight?
61  // op = Apply an operation to L? ('T'ranspose, 'H'ermitian, 'C'onjugate or 'N'othing)
62  uint64_t solveL(const Range& B, char side, char op) const;
63 
65  void solveD(const Range& B, char side) const;
66 
68  std::pair<int,int> inertia() const;
69 
71  int size() const;
72 
73  private:
74 
75  // Implementation details for factorization.
76  void constructor_detail();
77 
78  // Holds number data L.
80 
81  // For applying permutation P.
82  std::vector<int> P_swaps;
83 
84  // For applying permutation Q.
85  std::vector<int> Q_swaps;
86 
87  // For applying pivot rotations R.
89 
90  // Encodes inertia.
91  int n_plus;
92  int n_minus;
93 
94  };
95 
97 template<class Precision> class ReflectNumber <RLDLTSolver<Precision> >
98  { public: typedef Precision type; };
99 
100 } // namespace
101 
102 #endif
Reflects Number trait for a Container, containers of Numbers (Matrix&#39;s, Vector&#39;s, etc) should special...
Definition: Number.h:55
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).
Factors A = L*D*L&#39;, where D is a "sign matrix" of the form [I 0; 0 -I]. Presents solve methods...
Definition: RLDLTSolver.h:30