MyraMath
partialsolvel.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_LU_PARTIALSOLVEL_H
7 #define MYRAMATH_MULTIFRONTAL_LU_PARTIALSOLVEL_H
8 
15 
17 #include <myramath/dense/gemm.h>
18 #include <myramath/dense/detail/nwork.h>
19 
20 #include <myramath/multifrontal/detail/partialsolvel.h>
21 #include <myramath/multifrontal/detail/PContainer.h>
22 #include <myramath/multifrontal/detail/lu/LUContainer.h>
23 
24 namespace myra {
25 namespace multifrontal {
26 namespace lu {
27 namespace partialsolvel {
28 
29 template<class Kernel> class JobGraphBase : public ::myra::multifrontal::detail::partialsolvel::JobGraphBase2<typename ReflectNumber<Kernel>::type>
30  {
31  public:
32 
33  // Structural typedefs for base class.
34  typedef typename ReflectNumber<Kernel>::type Number;
35  typedef ::myra::multifrontal::detail::partialsolvel::JobGraphBase2<Number> Base;
36 
37  // Typedefs related to numeric storage.
38  typedef ::myra::multifrontal::detail::lu::LUContainer<Kernel> LUContainer;
39  typedef ::myra::multifrontal::detail::PContainer<Number> PContainer;
41  typedef MatrixRange<Number> Range;
42 
43  // Constructor - requires const reference to LUContainer, mutable reference to PContainer, and op (either 'N' or 'C')
44  JobGraphBase(const LUContainer* in_lucontainer, const SchurTree* in_stree, PContainer* in_pcontainer, char in_op)
45  : Base(in_stree,in_pcontainer), lucontainer(in_lucontainer), op(in_op) { }
46 
47  // Virtual copy constructor.
48  virtual ::myra::JobGraphBase* clone() const
49  { return new JobGraphBase(*this); }
50 
51  protected:
52 
53  // Accessors for L Kernel's / Block's
54  const Kernel& l(int n, int ij) const
55  { return lucontainer->lu(this->s2a(n),ij); }
56  const CRange l(int n, int i, int j) const
57  { return lucontainer->lu(this->s2a(n),i,j); }
58 
59  // Solves Ln(k,k)*Xn(k,j) = Bn(k,j)
60  virtual uint64_t backsolve(int n, int k, int j)
61  {
62  const Kernel& Ln_kk = this->l(n,k);
63  Range Bn_kj = this->b(n,k,j);
64  return Ln_kk.solveL(Bn_kj,'L',op);
65  }
66 
67  // Downdates Bn(i,j) -= Ln(i,k)*Xn(k,j)
68  virtual uint64_t downdate(int n, int k, int i, int j)
69  {
70  Range Bn_ij = this->b(n,i,j);
71  CRange Ln_ik = this->l(n,i,k);
72  CRange Xn_kj = this->x(n,k,j);
73  Number one(1);
74  return gemm_nwork(Bn_ij, Ln_ik, op, Xn_kj, 'N', -one, one);
75  }
76 
77  private:
78 
79  // Reference to LUContainer (const).
80  const LUContainer* lucontainer;
81 
82  // Op modifier, either 'N' or 'C'
83  char op;
84 
85  }; // class JobGraph
86 
87 } } } } // namespace
88 
89 #endif
Reflects Number trait for a Container, containers of Numbers (Matrix&#39;s, Vector&#39;s, etc) should special...
Definition: Number.h:55
Interface class for representing subranges of dense Matrix&#39;s.
Symbolic analysis data structure for multifrontal schur complement.
Definition: SchurTree.h:42
Definition: syntax.dox:1
Represents a const MatrixRange.
Definition: bothcat.h:22
Various utility functions/classes related to scalar Number types.
Represents a mutable MatrixRange.
Definition: conjugate.h:26
Definition: partialsolve.h:32
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.