34 template <
typename OrdinalType,
typename FadType>
37 OrdinalType workspace_size_) :
38 use_dynamic(use_dynamic_),
39 workspace_size(workspace_size_),
41 workspace_pointer(NULL)
43 if (workspace_size > 0) {
44 workspace =
new ValueType[workspace_size];
45 workspace_pointer = workspace;
49 template <
typename OrdinalType,
typename FadType>
52 use_dynamic(a.use_dynamic),
53 workspace_size(a.workspace_size),
55 workspace_pointer(NULL)
57 if (workspace_size > 0) {
58 workspace =
new ValueType*[workspace_size];
59 workspace_pointer = workspace;
64 template <
typename OrdinalType,
typename FadType>
78 if (workspace_size > 0)
82 template <
typename OrdinalType,
typename FadType>
89 template <
typename OrdinalType,
typename FadType>
96 template <
typename OrdinalType,
typename FadType>
103 template <
typename OrdinalType,
typename FadType>
114 "ArrayTraits::allocate_array(): " <<
115 "Requested workspace memory beyond size allocated. " <<
116 "Workspace size is " << workspace_size <<
117 ", currently used is " << workspace_pointer-workspace <<
118 ", requested size is " << size <<
".");
123 workspace_pointer += size;
127 template <
typename OrdinalType,
typename FadType>
132 if (use_dynamic && ptr != NULL)
135 workspace_pointer -= size;
138 template <
typename OrdinalType,
typename FadType>
144 (&(a[n-1].val())-&(a[0].
val()) == n-1) &&
145 (a[n-1].dx()-a[0].dx() == n-1);
148 template <
typename OrdinalType,
typename FadType>
152 OrdinalType static_workspace_size_) :
153 arrayTraits(use_dynamic_, static_workspace_size_),
155 use_default_impl(use_default_impl_)
159 template <
typename OrdinalType,
typename FadType>
162 arrayTraits(x.arrayTraits),
164 use_default_impl(x.use_default_impl)
168 template <
typename OrdinalType,
typename FadType>
174 template <
typename OrdinalType,
typename FadType>
177 GESV(
const OrdinalType n,
const OrdinalType nrhs,
FadType*
A,
const OrdinalType lda,
178 OrdinalType* IPIV,
FadType*
B,
const OrdinalType ldb, OrdinalType* info)
const {
180 if (use_default_impl) {
181 LAPACKType::GESV(n,nrhs,A,lda,IPIV,B,ldb,info);
186 arrayTraits.unpack();
198 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.