MyraMath
solveu_right.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_SOLVEU_RIGHT_H
7 #define MYRAMATH_MULTIFRONTAL_LU_SOLVEU_RIGHT_H
8 
14 #include <myramath/multifrontal/detail/solveu_right.h>
15 
16 namespace myra {
17 namespace multifrontal {
18 namespace lu {
19 namespace solveu_right {
20 
21 template<class Number> class JobGraphBase : public ::myra::multifrontal::detail::solveu_right::JobGraphBase2<Number>
22  {
23  public:
24 
25  // Structural typedefs for base class.
26  typedef ::myra::multifrontal::detail::solveu_right::JobGraphBase2<Number> Base;
27 
28  // Typedefs related to numeric storage on LUContainer
29  typedef LUKernel<Number> Kernel;
30  typedef ::myra::multifrontal::detail::lu::LUContainer<Kernel> LUContainer;
31 
32  // Constructor - requires const reference to LUContainer, mutable reference to right hand side.
33  JobGraphBase(const LUContainer* in_lucontainer, const MatrixRange<Number>& in_B, int in_blocksize)
34  : Base(&in_lucontainer->tree(), in_B, in_blocksize), lucontainer(in_lucontainer) { }
35 
36  // Virtual copy constructor.
37  virtual ::myra::JobGraphBase* clone() const
38  { return new JobGraphBase(*this); }
39 
40  protected:
41 
42  // Accesors for U Kernel's/Block's
43  const Kernel& u(int n, int ij) const
44  { return lucontainer->lu(n,ij); }
45  const CMatrixRange<Number> u(int n, int i, int j) const
46  { return lucontainer->lu(n,i,j); }
47 
48  // Solves Xn(i,k)*Un(k,k) = Bn(i,k)
49  virtual uint64_t backsolve(int n, int k, int i)
50  {
51  const Kernel& Un_kk = this->u(n,k);
52  MatrixRange<Number> Bn_ik = this->b(n,i,k);
53  return Un_kk.solveU(Bn_ik,'R','N');
54  }
55 
56  // Downdates Bn(i,j) -= Xn(i,k)*Un(k,j)
57  virtual uint64_t downdate(int n, int k, int i, int j)
58  {
59  CMatrixRange<Number> Un_kj = this->u(n,k,j);
60  CMatrixRange<Number> Xn_ik = this->x(n,i,k);
61  MatrixRange<Number> Bn_ij = this->b(n,i,j);
62  Number one(1);
63  return gemm_nwork(Bn_ij, Xn_ik, 'N', Un_kj, 'N', -one, one);
64  }
65 
66  private:
67 
68  // Reference to LUContainer (const).
69  const LUContainer* lucontainer;
70 
71  }; // class JobGraph
72 
73 } } } } // namespace
74 
75 #endif
Definition: syntax.dox:1
Represents a const MatrixRange.
Definition: bothcat.h:22
Factors A into L*U, presents solve methods.
Definition: Kernel.h:35
Represents a mutable MatrixRange.
Definition: conjugate.h:26
uint64_t solveU(const MatrixRange< Number > &B, char side, char op) const
Solves op(U)*X=B or X*op(U)=B, overwrites B with X.
Definition: Kernel.h:135
Definition: partialsolve.h:32