Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_Fad_LAPACK.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef SACADO_FAD_LAPACK_HPP
11 #define SACADO_FAD_LAPACK_HPP
12 
13 #include "Teuchos_LAPACK.hpp"
14 #include "Sacado_No_Kokkos.hpp"
15 #include "Sacado_CacheFad_DFad.hpp"
16 #include "Sacado_dummy_arg.hpp"
17 
18 namespace Sacado {
19 
20  namespace Fad {
21 
22  template <typename OrdinalType, typename FadType>
23  class ArrayTraits {
24 
28 
29  public:
30 
31  ArrayTraits(bool use_dynamic = true,
32  OrdinalType workspace_size = 0);
33 
34  ArrayTraits(const ArrayTraits& a);
35 
36  ~ArrayTraits();
37 
38  void unpack() const;
39 
40  void pack() const;
41 
42  void free() const;
43 
44  ValueType* allocate_array(OrdinalType size) const;
45 
46  void free_array(const ValueType* ptr, OrdinalType size) const;
47 
48  bool is_array_contiguous(const FadType* a, OrdinalType n,
49  OrdinalType n_dot) const;
50 
51  protected:
52 
54  bool use_dynamic;
55 
57  OrdinalType workspace_size;
58 
60  mutable ValueType *workspace;
61 
64 
65  };
66 
67  template <typename T> struct ArrayValueType { typedef T type; };
68 
70  template <typename OrdinalType, typename FadType>
71  class Fad_LAPACK {
72 
78 
79  public:
81 
82 
84  Fad_LAPACK(bool use_default_impl = true,
85  bool use_dynamic = true,
86  OrdinalType static_workspace_size = 0);
87 
89 
90  Fad_LAPACK(const Fad_LAPACK& x);
91 
93  virtual ~Fad_LAPACK();
94 
96 
98  void GESV(const OrdinalType n, const OrdinalType nrhs, FadType* A, const OrdinalType lda,
99  OrdinalType* IPIV, FadType* B, const OrdinalType ldb, OrdinalType* info) const;
100 
101  protected:
102 
105 
108 
111 
112  protected:
113 
115  void Fad_GESV() const;
116 
117  }; // class FadLAPACK
118 
119  } // namespace Fad
120 
121 } // namespace Sacado
122 
123 namespace Teuchos {
124  // Specialization of Teuchos::LAPACK for Sacado::Fad::DFad
125  template <typename OrdinalType, typename ScalarType>
126  class LAPACK< OrdinalType, Sacado::Fad::DFad<ScalarType> > :
127  public Sacado::Fad::Fad_LAPACK< OrdinalType, Sacado::Fad::DFad<ScalarType> > {};
128 }
129 
130 #include "Sacado_Fad_LAPACKImp.hpp"
131 
132 #endif // SACADO_FAD_LAPACK_HPP
bool is_array_contiguous(const FadType *a, OrdinalType n, OrdinalType n_dot) const
Teuchos::ScalarTraits< FadType >::magnitudeType MagnitudeType
bool use_dynamic
Use dynamic memory allocation.
ValueType * allocate_array(OrdinalType size) const
virtual ~Fad_LAPACK()
Destructor.
Sacado::dummy< ValueType, scalar_type >::type ScalarType
Sacado::ValueType< FadType >::type ValueType
void GESV(const OrdinalType n, const OrdinalType nrhs, FadType *A, const OrdinalType lda, OrdinalType *IPIV, FadType *B, const OrdinalType ldb, OrdinalType *info) const
Computes the solution to a real system of linear equations.
ValueType * workspace_pointer
Pointer to current free entry in workspace.
#define T
Definition: Sacado_rad.hpp:553
Fad specializations for Teuchos::LAPACK wrappers.
OrdinalType workspace_size
Size of static workspace.
GeneralFad< DynamicStorage< T > > DFad
Sacado::dummy< ValueType, scalar_type >::type ScalarType
ArrayTraits(bool use_dynamic=true, OrdinalType workspace_size=0)
Teuchos::LAPACK< OrdinalType, FadType > LAPACKType
Fad_LAPACK(bool use_default_impl=true, bool use_dynamic=true, OrdinalType static_workspace_size=0)
Default constructor.
void Fad_GESV() const
Implementation of GESV.
void free_array(const ValueType *ptr, OrdinalType size) const
ValueType * workspace
Workspace for holding contiguous values/derivatives.
Sacado::ScalarType< FadType >::type scalar_type
Sacado::ScalarType< FadType >::type scalar_type
Sacado::ValueType< FadType >::type ValueType
bool use_default_impl
Use custom or default implementation.
ArrayTraits< OrdinalType, FadType > arrayTraits
ArrayTraits for packing/unpacking value/derivative arrays.
Teuchos::LAPACK< OrdinalType, ValueType > lapack
LAPACK for values.