MyraMath
Kernel.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_MULTIFRONTAL_ZCHOLESKY_KERNEL_H
7 #define MYRAMATH_MULTIFRONTAL_ZCHOLESKY_KERNEL_H
8 
15 
16 #include <myramath/io/Streams.h>
18 
20 #include <myramath/dense/potrf.h>
21 #include <myramath/dense/trsm.h>
22 #include <myramath/dense/detail/nwork.h>
23 
24 #include <stdint.h>
25 
26 namespace myra {
27 
28 // Forward declarations.
29 class InputStream;
30 class OutputStream;
31 template<class Number> class MatrixRange;
32 template<class Number> class LowerMatrix;
33 
35 template<class Precision> class MYRAMATH_EXPORT ZCholeskyKernel
36  {
37  public:
38 
39  // Useful typedef.
40  typedef std::complex<Precision> Number;
41 
43  explicit ZCholeskyKernel()
44  { }
45 
48  { }
49 
52  { }
53 
55  void write(OutputStream& out) const
56  { }
57 
59  uint64_t factor()
60  { return potrf_nwork(L); }
61 
63  // side = Solve by L from the 'L'eft or from the 'R'ight?
64  // op = Apply an operation to L? ('T'ranspose, 'H'ermitian, 'C'onjugate or 'N'othing)
65  uint64_t solveL(const MatrixRange<Number>& B, char side, char op) const
66  { return trsm_nwork(side,op,L,B); }
67 
69  std::pair<int,int> inertia() const
70  { return std::pair<int,int>(size(),0); }
71 
73  int size() const
74  { return L.size(); }
75 
76  private:
77 
78  // Points to underlying data.
80  };
81 
83 template<class Precision> class ReflectNumber< ZCholeskyKernel<Precision> >
84  { public: typedef std::complex<Precision> type; };
85 
86 } // namespace myra
87 
88 #endif
uint64_t solveL(const MatrixRange< Number > &B, char side, char op) const
Solves op(L)*X=B or X*op(L)=B, overwrites B with X.
Definition: Kernel.h:65
Reflects Number trait for a Container, containers of Numbers (Matrix&#39;s, Vector&#39;s, etc) should special...
Definition: Number.h:55
Cholesky factorization routines for positive definite matrices.
int size() const
Size inspector.
Definition: Kernel.h:73
Represents a mutable LowerMatrixRange.
Definition: conjugate.h:28
ReaderWriter<T>, encapsulates a read()/write() pair for type T.
std::pair< int, int > inertia() const
Returns inertia I, (n_plus, n_minus). Useful for schur downdates.
Definition: Kernel.h:69
Range construct for a lower triangular matrix stored in rectangular packed format.
Definition: syntax.dox:1
ZCholeskyKernel()
Default constructor, initializes to 0 size.
Definition: Kernel.h:43
Routines for backsolving by a triangular Matrix or LowerMatrix.
Abstraction layer, serializable objects write themselves to these.
Definition: Streams.h:39
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
void write(OutputStream &out) const
Writes to an OutputStream.
Definition: Kernel.h:55
uint64_t factor()
Factors A = L*L&#39;.
Definition: Kernel.h:59
ZCholeskyKernel(LowerMatrixRange< Number > &A, InputStream &in)
Constructs from an InputStream, after seating reference to L.
Definition: Kernel.h:51
Factors A into L*L&#39;, presents solve methods.
Definition: Kernel.h:35
Bases classes for binary input/output streams.
ZCholeskyKernel(LowerMatrixRange< Number > &A)
Seats reference to L, to be factor()&#39;d later.
Definition: Kernel.h:47