12 template <
typename OrdinalType,
typename FadType>
15 OrdinalType workspace_size_) :
16 use_dynamic(use_dynamic_),
17 workspace_size(workspace_size_),
19 workspace_pointer(NULL)
21 if (workspace_size > 0) {
22 workspace =
new ValueType[workspace_size];
23 workspace_pointer = workspace;
27 template <
typename OrdinalType,
typename FadType>
30 use_dynamic(a.use_dynamic),
31 workspace_size(a.workspace_size),
33 workspace_pointer(NULL)
35 if (workspace_size > 0) {
36 workspace =
new ValueType*[workspace_size];
37 workspace_pointer = workspace;
42 template <
typename OrdinalType,
typename FadType>
56 if (workspace_size > 0)
60 template <
typename OrdinalType,
typename FadType>
67 template <
typename OrdinalType,
typename FadType>
74 template <
typename OrdinalType,
typename FadType>
81 template <
typename OrdinalType,
typename FadType>
92 "ArrayTraits::allocate_array(): " <<
93 "Requested workspace memory beyond size allocated. " <<
94 "Workspace size is " << workspace_size <<
95 ", currently used is " << workspace_pointer-workspace <<
96 ", requested size is " << size <<
".");
101 workspace_pointer += size;
105 template <
typename OrdinalType,
typename FadType>
110 if (use_dynamic && ptr != NULL)
113 workspace_pointer -= size;
116 template <
typename OrdinalType,
typename FadType>
122 (&(a[n-1].val())-&(a[0].
val()) == n-1) &&
123 (a[n-1].dx()-a[0].dx() == n-1);
126 template <
typename OrdinalType,
typename FadType>
130 OrdinalType static_workspace_size_) :
131 arrayTraits(use_dynamic_, static_workspace_size_),
133 use_default_impl(use_default_impl_)
137 template <
typename OrdinalType,
typename FadType>
140 arrayTraits(x.arrayTraits),
142 use_default_impl(x.use_default_impl)
146 template <
typename OrdinalType,
typename FadType>
152 template <
typename OrdinalType,
typename FadType>
155 GESV(
const OrdinalType n,
const OrdinalType nrhs,
FadType*
A,
const OrdinalType lda,
156 OrdinalType* IPIV,
FadType*
B,
const OrdinalType ldb, OrdinalType* info)
const {
158 if (use_default_impl) {
159 LAPACKType::GESV(n,nrhs,A,lda,IPIV,B,ldb,info);
164 arrayTraits.unpack();
176 template <
typename OrdinalType,
typename FadType>
bool is_array_contiguous(const FadType *a, OrdinalType n, OrdinalType n_dot) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ValueType * allocate_array(OrdinalType size) const
virtual ~Fad_LAPACK()
Destructor.
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.
Fad specializations for Teuchos::LAPACK wrappers.
ArrayTraits(bool use_dynamic=true, OrdinalType workspace_size=0)
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
Base template specification for ValueType.