Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado_Fad_LAPACK.hpp
Go to the documentation of this file.
1// $Id$
2// $Source$
3// @HEADER
4// ***********************************************************************
5//
6// Sacado Package
7// Copyright (2006) Sandia Corporation
8//
9// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
10// the U.S. Government retains certain rights in this software.
11//
12// This library is free software; you can redistribute it and/or modify
13// it under the terms of the GNU Lesser General Public License as
14// published by the Free Software Foundation; either version 2.1 of the
15// License, or (at your option) any later version.
16//
17// This library is distributed in the hope that it will be useful, but
18// WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20// Lesser General Public License for more details.
21//
22// You should have received a copy of the GNU Lesser General Public
23// License along with this library; if not, write to the Free Software
24// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
25// USA
26// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
27// (etphipp@sandia.gov).
28//
29// ***********************************************************************
30// @HEADER
31
32#ifndef SACADO_FAD_LAPACK_HPP
33#define SACADO_FAD_LAPACK_HPP
34
35#include "Teuchos_LAPACK.hpp"
36#include "Sacado_No_Kokkos.hpp"
38#include "Sacado_dummy_arg.hpp"
39
40namespace Sacado {
41
42 namespace Fad {
43
44 template <typename OrdinalType, typename FadType>
45 class ArrayTraits {
46
50
51 public:
52
54 OrdinalType workspace_size = 0);
55
57
59
60 void unpack() const;
61
62 void pack() const;
63
64 void free() const;
65
66 ValueType* allocate_array(OrdinalType size) const;
67
68 void free_array(const ValueType* ptr, OrdinalType size) const;
69
70 bool is_array_contiguous(const FadType* a, OrdinalType n,
71 OrdinalType n_dot) const;
72
73 protected:
74
76 bool use_dynamic;
77
79 OrdinalType workspace_size;
80
82 mutable ValueType *workspace;
83
86
87 };
88
89 template <typename T> struct ArrayValueType { typedef T type; };
90
92 template <typename OrdinalType, typename FadType>
93 class Fad_LAPACK {
94
95 typedef typename Teuchos::ScalarTraits<FadType>::magnitudeType MagnitudeType;
99 typedef Teuchos::LAPACK<OrdinalType,FadType> LAPACKType;
100
101 public:
103
104
106 Fad_LAPACK(bool use_default_impl = true,
107 bool use_dynamic = true,
108 OrdinalType static_workspace_size = 0);
109
111
112 Fad_LAPACK(const Fad_LAPACK& x);
113
115 virtual ~Fad_LAPACK();
116
118
120 void GESV(const OrdinalType n, const OrdinalType nrhs, FadType* A, const OrdinalType lda,
121 OrdinalType* IPIV, FadType* B, const OrdinalType ldb, OrdinalType* info) const;
122
123 protected:
124
127
129 Teuchos::LAPACK<OrdinalType, ValueType> lapack;
130
133
134 protected:
135
137 void Fad_GESV() const;
138
139 }; // class FadLAPACK
140
141 } // namespace Fad
142
143} // namespace Sacado
144
145namespace Teuchos {
146 // Specialization of Teuchos::LAPACK for Sacado::Fad::DFad
147 template <typename OrdinalType, typename ScalarType>
148 class LAPACK< OrdinalType, Sacado::Fad::DFad<ScalarType> > :
149 public Sacado::Fad::Fad_LAPACK< OrdinalType, Sacado::Fad::DFad<ScalarType> > {};
150}
151
153
154#endif // SACADO_FAD_LAPACK_HPP
#define T
Definition: Sacado_rad.hpp:573
#define A
Definition: Sacado_rad.hpp:572
void free_array(const ValueType *ptr, OrdinalType size) const
OrdinalType workspace_size
Size of static workspace.
Sacado::ValueType< FadType >::type ValueType
Sacado::dummy< ValueType, scalar_type >::type ScalarType
ValueType * workspace
Workspace for holding contiguous values/derivatives.
bool use_dynamic
Use dynamic memory allocation.
ArrayTraits(const ArrayTraits &a)
Sacado::ScalarType< FadType >::type scalar_type
ValueType * workspace_pointer
Pointer to current free entry in workspace.
bool is_array_contiguous(const FadType *a, OrdinalType n, OrdinalType n_dot) const
ValueType * allocate_array(OrdinalType size) const
ArrayTraits(bool use_dynamic=true, OrdinalType workspace_size=0)
Fad specializations for Teuchos::LAPACK wrappers.
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.
void Fad_GESV() const
Implementation of GESV.
Sacado::dummy< ValueType, scalar_type >::type ScalarType
Teuchos::LAPACK< OrdinalType, ValueType > lapack
LAPACK for values.
bool use_default_impl
Use custom or default implementation.
Teuchos::ScalarTraits< FadType >::magnitudeType MagnitudeType
ArrayTraits< OrdinalType, FadType > arrayTraits
ArrayTraits for packing/unpacking value/derivative arrays.
Teuchos::LAPACK< OrdinalType, FadType > LAPACKType
virtual ~Fad_LAPACK()
Destructor.
Sacado::ScalarType< FadType >::type scalar_type
Sacado::ValueType< FadType >::type ValueType