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