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_BLAS.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_BLAS_HPP
33 #define SACADO_FAD_BLAS_HPP
34 
35 #include "Teuchos_BLAS.hpp"
36 #include "Sacado_No_Kokkos.hpp"
37 #include "Sacado_CacheFad_DFad.hpp"
38 #include "Sacado_dummy_arg.hpp"
39 
40 namespace Sacado {
41 
42  namespace Fad {
43 
44  template <typename OrdinalType, typename FadType>
45  class ArrayTraits {
46 
50 
51  public:
52 
53  ArrayTraits(bool use_dynamic = true,
54  OrdinalType workspace_size = 0);
55 
56  ArrayTraits(const ArrayTraits& a);
57 
58  ~ArrayTraits();
59 
60  void unpack(const FadType& a, OrdinalType& n_dot, ValueType& val,
61  const ValueType*& dot) const;
62 
63  void unpack(const FadType* a, OrdinalType n, OrdinalType inc,
64  OrdinalType& n_dot, OrdinalType& inc_val,
65  OrdinalType& inc_dot,
66  const ValueType*& val, const ValueType*& dot) const;
67 
68  void unpack(const FadType* A, OrdinalType m, OrdinalType n,
69  OrdinalType lda, OrdinalType& n_dot,
70  OrdinalType& lda_val, OrdinalType& lda_dot,
71  const ValueType*& val, const ValueType*& dot) const;
72 
73  void unpack(const ValueType& a, OrdinalType& n_dot, ValueType& val,
74  const ValueType*& dot) const;
75 
76  void unpack(const ValueType* a, OrdinalType n, OrdinalType inc,
77  OrdinalType& n_dot, OrdinalType& inc_val,
78  OrdinalType& inc_dot,
79  const ValueType*& val, const ValueType*& dot) const;
80 
81  void unpack(const ValueType* A, OrdinalType m, OrdinalType n,
82  OrdinalType lda, OrdinalType& n_dot,
83  OrdinalType& lda_val, OrdinalType& lda_dot,
84  const ValueType*& val, const ValueType*& dot) const;
85 
86  void unpack(const ScalarType& a, OrdinalType& n_dot, ScalarType& val,
87  const ScalarType*& dot) const;
88 
89  void unpack(const ScalarType* a, OrdinalType n, OrdinalType inc,
90  OrdinalType& n_dot, OrdinalType& inc_val,
91  OrdinalType& inc_dot,
92  const ScalarType*& val, const ScalarType*& dot) const;
93 
94  void unpack(const ScalarType* A, OrdinalType m, OrdinalType n,
95  OrdinalType lda, OrdinalType& n_dot,
96  OrdinalType& lda_val, OrdinalType& lda_dot,
97  const ScalarType*& val, const ScalarType*& dot) const;
98 
99  void unpack(FadType& a, OrdinalType& n_dot, OrdinalType& final_n_dot,
100  ValueType& val, ValueType*& dot) const;
101 
102  void unpack(FadType* a, OrdinalType n, OrdinalType inc,
103  OrdinalType& n_dot, OrdinalType& final_n_dot,
104  OrdinalType& inc_val, OrdinalType& inc_dot,
105  ValueType*& val, ValueType*& dot) const;
106 
107  void unpack(FadType* A, OrdinalType m, OrdinalType n, OrdinalType lda,
108  OrdinalType& n_dot, OrdinalType& final_n_dot,
109  OrdinalType& lda_val, OrdinalType& lda_dot,
110  ValueType*& val, ValueType*& dot) const;
111 
112  void pack(FadType& a, OrdinalType n_dot, const ValueType& val,
113  const ValueType* dot) const;
114 
115  void pack(FadType* a, OrdinalType n, OrdinalType inc,
116  OrdinalType n_dot, OrdinalType inc_val, OrdinalType inc_dot,
117  const ValueType* val, const ValueType* dot) const;
118 
119  void pack(FadType* A, OrdinalType m, OrdinalType n,
120  OrdinalType lda, OrdinalType n_dot,
121  OrdinalType lda_val, OrdinalType lda_dot,
122  const ValueType* val, const ValueType* dot) const;
123 
124  void free(const FadType& a, OrdinalType n_dot,
125  const ValueType* dot) const;
126 
127  void free(const FadType* a, OrdinalType n, OrdinalType n_dot,
128  OrdinalType inc_val, OrdinalType inc_dot,
129  const ValueType* val, const ValueType* dot) const;
130 
131  void free(const FadType* A, OrdinalType m, OrdinalType n,
132  OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
133  const ValueType* val, const ValueType* dot) const;
134 
135  void free(const ValueType& a, OrdinalType n_dot,
136  const ValueType* dot) const {}
137 
138  void free(const ValueType* a, OrdinalType n, OrdinalType n_dot,
139  OrdinalType inc_val, OrdinalType inc_dot,
140  const ValueType* val, const ValueType* dot) const {}
141 
142  void free(const ValueType* A, OrdinalType m, OrdinalType n,
143  OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
144  const ValueType* val, const ValueType* dot) const {}
145 
146  void free(const ScalarType& a, OrdinalType n_dot,
147  const ScalarType* dot) const {}
148 
149  void free(const ScalarType* a, OrdinalType n, OrdinalType n_dot,
150  OrdinalType inc_val, OrdinalType inc_dot,
151  const ScalarType* val, const ScalarType* dot) const {}
152 
153  void free(const ScalarType* A, OrdinalType m, OrdinalType n,
154  OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
155  const ScalarType* val, const ScalarType* dot) const {}
156 
157  ValueType* allocate_array(OrdinalType size) const;
158 
159  void free_array(const ValueType* ptr, OrdinalType size) const;
160 
161  bool is_array_contiguous(const FadType* a, OrdinalType n,
162  OrdinalType n_dot) const;
163 
164  protected:
165 
168 
170  OrdinalType workspace_size;
171 
174 
177 
178  };
179 
180  template <typename T> struct ArrayValueType { typedef T type; };
181 
183  template <typename OrdinalType, typename FadType>
184  class BLAS : public Teuchos::DefaultBLASImpl<OrdinalType,FadType> {
185 
191 
192  public:
194 
195 
197  BLAS(bool use_default_impl = true,
198  bool use_dynamic = true, OrdinalType static_workspace_size = 0);
199 
201 
202  BLAS(const BLAS& x);
203 
205  virtual ~BLAS();
206 
208 
210 
211 
213  void ROTG(FadType* da, FadType* db, MagnitudeType* c, FadType* s) const {
214  BLASType::ROTG(da,db,c,s);
215  }
216 
218  void ROT(const OrdinalType n, FadType* dx, const OrdinalType incx,
219  FadType* dy, const OrdinalType incy, MagnitudeType* c,
220  FadType* s) const {
221  BLASType::ROT(n,dx,incx,dy,incy,c,s);
222  }
223 
225  void SCAL(const OrdinalType n, const FadType& alpha, FadType* x,
226  const OrdinalType incx) const;
227 
229  void COPY(const OrdinalType n, const FadType* x,
230  const OrdinalType incx, FadType* y,
231  const OrdinalType incy) const;
232 
234  template <typename alpha_type, typename x_type>
235  void AXPY(const OrdinalType n, const alpha_type& alpha,
236  const x_type* x, const OrdinalType incx, FadType* y,
237  const OrdinalType incy) const;
238 
241  ASUM(const OrdinalType n, const FadType* x,
242  const OrdinalType incx) const {
243  return BLASType::ASUM(n,x,incx);
244  }
245 
247  template <typename x_type, typename y_type>
248  FadType DOT(const OrdinalType n, const x_type* x,
249  const OrdinalType incx, const y_type* y,
250  const OrdinalType incy) const;
251 
253  MagnitudeType NRM2(const OrdinalType n, const FadType* x,
254  const OrdinalType incx) const;
255 
257  OrdinalType IAMAX(const OrdinalType n, const FadType* x,
258  const OrdinalType incx) const {
259  return BLASType::IAMAX(n,x,incx);
260  }
261 
263 
265 
266 
272  template <typename alpha_type, typename A_type, typename x_type,
273  typename beta_type>
274  void GEMV(Teuchos::ETransp trans, const OrdinalType m,
275  const OrdinalType n,
276  const alpha_type& alpha, const A_type* A,
277  const OrdinalType lda, const x_type* x,
278  const OrdinalType incx, const beta_type& beta,
279  FadType* y, const OrdinalType incy) const;
280 
286  template <typename A_type>
287  void TRMV(Teuchos::EUplo uplo, Teuchos::ETransp trans,
288  Teuchos::EDiag diag, const OrdinalType n,
289  const A_type* A, const OrdinalType lda, FadType* x,
290  const OrdinalType incx) const;
291 
293  template <typename alpha_type, typename x_type, typename y_type>
294  void GER(const OrdinalType m, const OrdinalType n,
295  const alpha_type& alpha,
296  const x_type* x, const OrdinalType incx,
297  const y_type* y, const OrdinalType incy,
298  FadType* A, const OrdinalType lda) const;
299 
301 
303 
304 
311  template <typename alpha_type, typename A_type, typename B_type,
312  typename beta_type>
313  void GEMM(Teuchos::ETransp transa, Teuchos::ETransp transb,
314  const OrdinalType m, const OrdinalType n, const OrdinalType k,
315  const alpha_type& alpha, const A_type* A, const OrdinalType lda,
316  const B_type* B, const OrdinalType ldb, const beta_type& beta,
317  FadType* C, const OrdinalType ldc) const;
318 
325  template <typename alpha_type, typename A_type, typename B_type,
326  typename beta_type>
327  void SYMM(Teuchos::ESide side, Teuchos::EUplo uplo, const OrdinalType m,
328  const OrdinalType n,
329  const alpha_type& alpha, const A_type* A,
330  const OrdinalType lda, const B_type* B,
331  const OrdinalType ldb,
332  const beta_type& beta, FadType* C,
333  const OrdinalType ldc) const;
334 
341  template <typename alpha_type, typename A_type>
342  void TRMM(Teuchos::ESide side, Teuchos::EUplo uplo,
343  Teuchos::ETransp transa, Teuchos::EDiag diag,
344  const OrdinalType m, const OrdinalType n,
345  const alpha_type& alpha,
346  const A_type* A, const OrdinalType lda,
347  FadType* B, const OrdinalType ldb) const;
348 
356  template <typename alpha_type, typename A_type>
357  void TRSM(Teuchos::ESide side, Teuchos::EUplo uplo,
358  Teuchos::ETransp transa, Teuchos::EDiag diag,
359  const OrdinalType m, const OrdinalType n,
360  const alpha_type& alpha,
361  const A_type* A, const OrdinalType lda,
362  FadType* B, const OrdinalType ldb) const;
363 
365 
366  protected:
367 
370 
373 
376 
378  mutable std::vector<ValueType> gemv_Ax;
379 
381  mutable std::vector<ValueType> gemm_AB;
382 
383  protected:
384 
386  template <typename x_type, typename y_type>
387  void Fad_DOT(const OrdinalType n,
388  const x_type* x,
389  const OrdinalType incx,
390  const OrdinalType n_x_dot,
391  const x_type* x_dot,
392  const OrdinalType incx_dot,
393  const y_type* y,
394  const OrdinalType incy,
395  const OrdinalType n_y_dot,
396  const y_type* y_dot,
397  const OrdinalType incy_dot,
398  ValueType& z,
399  const OrdinalType n_z_dot,
400  ValueType* zdot) const;
401 
403  template <typename alpha_type, typename A_type, typename x_type,
404  typename beta_type>
405  void Fad_GEMV(Teuchos::ETransp trans,
406  const OrdinalType m,
407  const OrdinalType n,
408  const alpha_type& alpha,
409  const OrdinalType n_alpha_dot,
410  const alpha_type* alpha_dot,
411  const A_type* A,
412  const OrdinalType lda,
413  const OrdinalType n_A_dot,
414  const A_type* A_dot,
415  const OrdinalType lda_dot,
416  const x_type* x,
417  const OrdinalType incx,
418  const OrdinalType n_x_dot,
419  const x_type* x_dot,
420  const OrdinalType incx_dot,
421  const beta_type& beta,
422  const OrdinalType n_beta_dot,
423  const beta_type* beta_dot,
424  ValueType* y,
425  const OrdinalType incy,
426  const OrdinalType n_y_dot,
427  ValueType* y_dot,
428  const OrdinalType incy_dot,
429  const OrdinalType n_dot) const;
430 
432  template <typename alpha_type, typename x_type, typename y_type>
433  void Fad_GER(const OrdinalType m,
434  const OrdinalType n,
435  const alpha_type& alpha,
436  const OrdinalType n_alpha_dot,
437  const alpha_type* alpha_dot,
438  const x_type* x,
439  const OrdinalType incx,
440  const OrdinalType n_x_dot,
441  const x_type* x_dot,
442  const OrdinalType incx_dot,
443  const y_type* y,
444  const OrdinalType incy,
445  const OrdinalType n_y_dot,
446  const y_type* y_dot,
447  const OrdinalType incy_dot,
448  ValueType* A,
449  const OrdinalType lda,
450  const OrdinalType n_A_dot,
451  ValueType* A_dot,
452  const OrdinalType lda_dot,
453  const OrdinalType n_dot) const;
454 
456  template <typename alpha_type, typename A_type, typename B_type,
457  typename beta_type>
458  void Fad_GEMM(Teuchos::ETransp transa,
459  Teuchos::ETransp transb,
460  const OrdinalType m,
461  const OrdinalType n,
462  const OrdinalType k,
463  const alpha_type& alpha,
464  const OrdinalType n_alpha_dot,
465  const alpha_type* alpha_dot,
466  const A_type* A,
467  const OrdinalType lda,
468  const OrdinalType n_A_dot,
469  const A_type* A_dot,
470  const OrdinalType lda_dot,
471  const B_type* B,
472  const OrdinalType ldb,
473  const OrdinalType n_B_dot,
474  const B_type* B_dot,
475  const OrdinalType ldb_dot,
476  const beta_type& beta,
477  const OrdinalType n_beta_dot,
478  const beta_type* beta_dot,
479  ValueType* C,
480  const OrdinalType ldc,
481  const OrdinalType n_C_dot,
482  ValueType* C_dot,
483  const OrdinalType ldc_dot,
484  const OrdinalType n_dot) const;
485 
487  template <typename alpha_type, typename A_type, typename B_type,
488  typename beta_type>
489  void Fad_SYMM(Teuchos::ESide side,
490  Teuchos::EUplo uplo,
491  const OrdinalType m,
492  const OrdinalType n,
493  const alpha_type& alpha,
494  const OrdinalType n_alpha_dot,
495  const alpha_type* alpha_dot,
496  const A_type* A,
497  const OrdinalType lda,
498  const OrdinalType n_A_dot,
499  const A_type* A_dot,
500  const OrdinalType lda_dot,
501  const B_type* B,
502  const OrdinalType ldb,
503  const OrdinalType n_B_dot,
504  const B_type* B_dot,
505  const OrdinalType ldb_dot,
506  const beta_type& beta,
507  const OrdinalType n_beta_dot,
508  const beta_type* beta_dot,
509  ValueType* C,
510  const OrdinalType ldc,
511  const OrdinalType n_C_dot,
512  ValueType* C_dot,
513  const OrdinalType ldc_dot,
514  const OrdinalType n_dot) const;
515 
517  template <typename alpha_type, typename A_type>
518  void Fad_TRMM(Teuchos::ESide side,
519  Teuchos::EUplo uplo,
520  Teuchos::ETransp transa,
521  Teuchos::EDiag diag,
522  const OrdinalType m,
523  const OrdinalType n,
524  const alpha_type& alpha,
525  const OrdinalType n_alpha_dot,
526  const alpha_type* alpha_dot,
527  const A_type* A,
528  const OrdinalType lda,
529  const OrdinalType n_A_dot,
530  const A_type* A_dot,
531  const OrdinalType lda_dot,
532  ValueType* B,
533  const OrdinalType ldb,
534  const OrdinalType n_B_dot,
535  ValueType* B_dot,
536  const OrdinalType ldb_dot,
537  const OrdinalType n_dot) const;
538 
540  template <typename alpha_type, typename A_type>
541  void Fad_TRSM(Teuchos::ESide side,
542  Teuchos::EUplo uplo,
543  Teuchos::ETransp transa,
544  Teuchos::EDiag diag,
545  const OrdinalType m,
546  const OrdinalType n,
547  const alpha_type& alpha,
548  const OrdinalType n_alpha_dot,
549  const alpha_type* alpha_dot,
550  const A_type* A,
551  const OrdinalType lda,
552  const OrdinalType n_A_dot,
553  const A_type* A_dot,
554  const OrdinalType lda_dot,
555  ValueType* B,
556  const OrdinalType ldb,
557  const OrdinalType n_B_dot,
558  ValueType* B_dot,
559  const OrdinalType ldb_dot,
560  const OrdinalType n_dot) const;
561 
562  }; // class FadBLAS
563 
564  } // namespace Fad
565 
566  // template <typename FadType> ArrayValueType<FadType> { typedef ValueType type; };
567  // template <> ArrayValueType<ValueType> { typedef ValueType type; };
568  // template <> ArrayValueType<ScalarType> { typedef ScalarType type; };
569 
570 } // namespace Sacado
571 
572 // Here we provide partial specializations for Teuchos::BLAS for each Fad type
573 #define TEUCHOS_BLAS_FAD_SPEC(FADTYPE) \
574 namespace Teuchos { \
575  template <typename OrdinalType, typename ValueT> \
576  class BLAS< OrdinalType, FADTYPE<ValueT> > : \
577  public Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> > { \
578  public: \
579  BLAS(bool use_default_impl = true, bool use_dynamic = true, \
580  OrdinalType static_workspace_size = 0) : \
581  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> >( \
582  use_default_impl, use_dynamic,static_workspace_size) {} \
583  BLAS(const BLAS& x) : \
584  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> >(x) {} \
585  virtual ~BLAS() {} \
586  }; \
587 } \
588 namespace Sacado { \
589  namespace Fad { \
590  template <typename ValueT> \
591  struct ArrayValueType< FADTYPE<ValueT> > { \
592  typedef ValueT type; \
593  }; \
594  } \
595 }
596 #define TEUCHOS_BLAS_SFAD_SPEC(FADTYPE) \
597 namespace Teuchos { \
598  template <typename OrdinalType, typename ValueT, int Num> \
599  class BLAS< OrdinalType, FADTYPE<ValueT,Num> > : \
600  public Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> > { \
601  public: \
602  BLAS(bool use_default_impl = true, bool use_dynamic = true, \
603  OrdinalType static_workspace_size = 0) : \
604  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> >( \
605  use_default_impl, use_dynamic, static_workspace_size) {} \
606  BLAS(const BLAS& x) : \
607  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> >(x) {} \
608  virtual ~BLAS() {} \
609  }; \
610 } \
611 namespace Sacado { \
612  namespace Fad { \
613  template <typename ValueT, int Num> \
614  struct ArrayValueType< FADTYPE<ValueT,Num> > { \
615  typedef ValueT type; \
616  }; \
617  } \
618 }
620 TEUCHOS_BLAS_SFAD_SPEC(Sacado::Fad::SFad)
621 TEUCHOS_BLAS_SFAD_SPEC(Sacado::Fad::SLFad)
622 TEUCHOS_BLAS_FAD_SPEC(Sacado::Fad::DMFad)
623 TEUCHOS_BLAS_FAD_SPEC(Sacado::Fad::DVFad)
624 TEUCHOS_BLAS_FAD_SPEC(Sacado::ELRFad::DFad)
625 TEUCHOS_BLAS_SFAD_SPEC(Sacado::ELRFad::SFad)
626 TEUCHOS_BLAS_SFAD_SPEC(Sacado::ELRFad::SLFad)
627 TEUCHOS_BLAS_FAD_SPEC(Sacado::CacheFad::DFad)
628 
629 #undef TEUCHOS_BLAS_FAD_SPEC
630 #undef TEUCHOS_BLAS_SFAD_SPEC
631 
632 #include "Sacado_Fad_BLASImp.hpp"
633 
634 #endif // SACADO_FAD_BLAS_HPP
void TRSM(Teuchos::ESide side, Teuchos::EUplo uplo, Teuchos::ETransp transa, Teuchos::EDiag diag, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const A_type *A, const OrdinalType lda, FadType *B, const OrdinalType ldb) const
Solves the matrix equations: op(A)*X=alpha*B or X*op(A)=alpha*B where X and B are m by n matrices...
void TRMV(Teuchos::EUplo uplo, Teuchos::ETransp trans, Teuchos::EDiag diag, const OrdinalType n, const A_type *A, const OrdinalType lda, FadType *x, const OrdinalType incx) const
Performs the matrix-std::vector operation: x &lt;- A*x or x &lt;- A&#39;*x where A is a unit/non-unit n by n uppe...
void ROT(const OrdinalType n, FadType *dx, const OrdinalType incx, FadType *dy, const OrdinalType incy, MagnitudeType *c, FadType *s) const
Applies a Givens plane rotation.
void Fad_GEMM(Teuchos::ETransp transa, Teuchos::ETransp transb, const OrdinalType m, const OrdinalType n, const OrdinalType k, const alpha_type &alpha, const OrdinalType n_alpha_dot, const alpha_type *alpha_dot, const A_type *A, const OrdinalType lda, const OrdinalType n_A_dot, const A_type *A_dot, const OrdinalType lda_dot, const B_type *B, const OrdinalType ldb, const OrdinalType n_B_dot, const B_type *B_dot, const OrdinalType ldb_dot, const beta_type &beta, const OrdinalType n_beta_dot, const beta_type *beta_dot, ValueType *C, const OrdinalType ldc, const OrdinalType n_C_dot, ValueType *C_dot, const OrdinalType ldc_dot, const OrdinalType n_dot) const
Implementation of GEMM.
Teuchos::DefaultBLASImpl< OrdinalType, FadType > BLASType
void GEMV(Teuchos::ETransp trans, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const A_type *A, const OrdinalType lda, const x_type *x, const OrdinalType incx, const beta_type &beta, FadType *y, const OrdinalType incy) const
Performs the matrix-std::vector operation: y &lt;- alpha*A*x+beta*y or y &lt;- alpha*A&#39;*x+beta*y where A is a...
void GER(const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const x_type *x, const OrdinalType incx, const y_type *y, const OrdinalType incy, FadType *A, const OrdinalType lda) const
Performs the rank 1 operation: A &lt;- alpha*x*y&#39;+A.
Sacado::dummy< ValueType, scalar_type >::type ScalarType
bool use_default_impl
Use custom or default implementation.
void ROTG(FadType *da, FadType *db, MagnitudeType *c, FadType *s) const
Computes a Givens plane rotation.
expr expr dx(i)
void Fad_TRSM(Teuchos::ESide side, Teuchos::EUplo uplo, Teuchos::ETransp transa, Teuchos::EDiag diag, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const OrdinalType n_alpha_dot, const alpha_type *alpha_dot, const A_type *A, const OrdinalType lda, const OrdinalType n_A_dot, const A_type *A_dot, const OrdinalType lda_dot, ValueType *B, const OrdinalType ldb, const OrdinalType n_B_dot, ValueType *B_dot, const OrdinalType ldb_dot, const OrdinalType n_dot) const
Implementation of TRMM.
std::vector< ValueType > gemv_Ax
Temporary array for GEMV.
bool is_array_contiguous(const FadType *a, OrdinalType n, OrdinalType n_dot) const
void ROT(const OrdinalType &n, ScalarType *dx, const OrdinalType &incx, ScalarType *dy, const OrdinalType &incy, MagnitudeType *c, ScalarType *s) const
FadType DOT(const OrdinalType n, const x_type *x, const OrdinalType incx, const y_type *y, const OrdinalType incy) const
Form the dot product of the vectors x and y.
virtual ~BLAS()
Destructor.
Fad specializations for Teuchos::BLAS wrappers.
void GEMM(Teuchos::ETransp transa, Teuchos::ETransp transb, const OrdinalType m, const OrdinalType n, const OrdinalType k, const alpha_type &alpha, const A_type *A, const OrdinalType lda, const B_type *B, const OrdinalType ldb, const beta_type &beta, FadType *C, const OrdinalType ldc) const
Performs the matrix-matrix operation: C &lt;- alpha*op(A)*op(B)+beta*C where op(A) is either A or A&#39;...
GeneralFad< MemPoolStorage< T > > DMFad
OrdinalType IAMAX(const OrdinalType n, const FadType *x, const OrdinalType incx) const
Return the index of the element of x with the maximum magnitude.
GeneralFad< StaticStorage< T, Num > > SLFad
bool use_dynamic
Use dynamic memory allocation.
#define TEUCHOS_BLAS_SFAD_SPEC(FADTYPE)
ValueType * allocate_array(OrdinalType size) const
ArrayTraits< OrdinalType, FadType > arrayTraits
ArrayTraits for packing/unpacking value/derivative arrays.
Sacado::ScalarType< FadType >::type scalar_type
OrdinalType IAMAX(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx) const
Teuchos::ScalarTraits< FadType >::magnitudeType ASUM(const OrdinalType n, const FadType *x, const OrdinalType incx) const
Sum the absolute values of the entries of x.
#define TEUCHOS_BLAS_FAD_SPEC(FADTYPE)
void free(const ScalarType &a, OrdinalType n_dot, const ScalarType *dot) const
void TRMM(Teuchos::ESide side, Teuchos::EUplo uplo, Teuchos::ETransp transa, Teuchos::EDiag diag, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const A_type *A, const OrdinalType lda, FadType *B, const OrdinalType ldb) const
Performs the matrix-matrix operation: C &lt;- alpha*op(A)*B+beta*C or C &lt;- alpha*B*op(A)+beta*C where op...
ScalarTraits< ScalarType >::magnitudeType ASUM(const OrdinalType &n, const ScalarType *x, const OrdinalType &incx) const
ValueType * workspace_pointer
Pointer to current free entry in workspace.
expr val()
#define T
Definition: Sacado_rad.hpp:573
expr expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c *expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr1 c expr2 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 expr2 expr1 expr2 expr1 expr1 expr1 c
OrdinalType workspace_size
Size of static workspace.
std::vector< ValueType > gemm_AB
Temporary array for GEMM.
GeneralFad< DynamicStorage< T > > DFad
Teuchos::BLAS< OrdinalType, ValueType > blas
BLAS for values.
void Fad_SYMM(Teuchos::ESide side, Teuchos::EUplo uplo, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const OrdinalType n_alpha_dot, const alpha_type *alpha_dot, const A_type *A, const OrdinalType lda, const OrdinalType n_A_dot, const A_type *A_dot, const OrdinalType lda_dot, const B_type *B, const OrdinalType ldb, const OrdinalType n_B_dot, const B_type *B_dot, const OrdinalType ldb_dot, const beta_type &beta, const OrdinalType n_beta_dot, const beta_type *beta_dot, ValueType *C, const OrdinalType ldc, const OrdinalType n_C_dot, ValueType *C_dot, const OrdinalType ldc_dot, const OrdinalType n_dot) const
Implementation of SYMM.
Sacado::dummy< ValueType, scalar_type >::type ScalarType
GeneralFad< VectorDynamicStorage< T > > DVFad
void free(const ValueType *A, OrdinalType m, OrdinalType n, OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot, const ValueType *val, const ValueType *dot) const
ArrayTraits(bool use_dynamic=true, OrdinalType workspace_size=0)
void AXPY(const OrdinalType n, const alpha_type &alpha, const x_type *x, const OrdinalType incx, FadType *y, const OrdinalType incy) const
Perform the operation: y &lt;- y+alpha*x.
void COPY(const OrdinalType n, const FadType *x, const OrdinalType incx, FadType *y, const OrdinalType incy) const
Copy the std::vector x to the std::vector y.
Teuchos::ScalarTraits< FadType >::magnitudeType MagnitudeType
void SYMM(Teuchos::ESide side, Teuchos::EUplo uplo, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const A_type *A, const OrdinalType lda, const B_type *B, const OrdinalType ldb, const beta_type &beta, FadType *C, const OrdinalType ldc) const
Performs the matrix-matrix operation: C &lt;- alpha*A*B+beta*C or C &lt;- alpha*B*A+beta*C where A is an m ...
void Fad_TRMM(Teuchos::ESide side, Teuchos::EUplo uplo, Teuchos::ETransp transa, Teuchos::EDiag diag, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const OrdinalType n_alpha_dot, const alpha_type *alpha_dot, const A_type *A, const OrdinalType lda, const OrdinalType n_A_dot, const A_type *A_dot, const OrdinalType lda_dot, ValueType *B, const OrdinalType ldb, const OrdinalType n_B_dot, ValueType *B_dot, const OrdinalType ldb_dot, const OrdinalType n_dot) const
Implementation of TRMM.
void free(const ScalarType *a, OrdinalType n, OrdinalType n_dot, OrdinalType inc_val, OrdinalType inc_dot, const ScalarType *val, const ScalarType *dot) const
void free(const ScalarType *A, OrdinalType m, OrdinalType n, OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot, const ScalarType *val, const ScalarType *dot) const
void free_array(const ValueType *ptr, OrdinalType size) const
MagnitudeType NRM2(const OrdinalType n, const FadType *x, const OrdinalType incx) const
Compute the 2-norm of the std::vector x.
void ROTG(ScalarType *da, ScalarType *db, rotg_c_type *c, ScalarType *s) const
ValueType * workspace
Workspace for holding contiguous values/derivatives.
Sacado::ScalarType< FadType >::type scalar_type
void Fad_GEMV(Teuchos::ETransp trans, const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const OrdinalType n_alpha_dot, const alpha_type *alpha_dot, const A_type *A, const OrdinalType lda, const OrdinalType n_A_dot, const A_type *A_dot, const OrdinalType lda_dot, const x_type *x, const OrdinalType incx, const OrdinalType n_x_dot, const x_type *x_dot, const OrdinalType incx_dot, const beta_type &beta, const OrdinalType n_beta_dot, const beta_type *beta_dot, ValueType *y, const OrdinalType incy, const OrdinalType n_y_dot, ValueType *y_dot, const OrdinalType incy_dot, const OrdinalType n_dot) const
Implementation of GEMV.
void free(const ValueType *a, OrdinalType n, OrdinalType n_dot, OrdinalType inc_val, OrdinalType inc_dot, const ValueType *val, const ValueType *dot) const
Sacado::ValueType< FadType >::type ValueType
void free(const ValueType &a, OrdinalType n_dot, const ValueType *dot) const
void SCAL(const OrdinalType n, const FadType &alpha, FadType *x, const OrdinalType incx) const
Scale the std::vector x by the constant alpha.
void Fad_DOT(const OrdinalType n, const x_type *x, const OrdinalType incx, const OrdinalType n_x_dot, const x_type *x_dot, const OrdinalType incx_dot, const y_type *y, const OrdinalType incy, const OrdinalType n_y_dot, const y_type *y_dot, const OrdinalType incy_dot, ValueType &z, const OrdinalType n_z_dot, ValueType *zdot) const
Implementation of DOT.
GeneralFad< StaticFixedStorage< T, Num > > SFad
Base template specification for ValueType.
Sacado::ValueType< FadType >::type ValueType
void Fad_GER(const OrdinalType m, const OrdinalType n, const alpha_type &alpha, const OrdinalType n_alpha_dot, const alpha_type *alpha_dot, const x_type *x, const OrdinalType incx, const OrdinalType n_x_dot, const x_type *x_dot, const OrdinalType incx_dot, const y_type *y, const OrdinalType incy, const OrdinalType n_y_dot, const y_type *y_dot, const OrdinalType incy_dot, ValueType *A, const OrdinalType lda, const OrdinalType n_A_dot, ValueType *A_dot, const OrdinalType lda_dot, const OrdinalType n_dot) const
Implementation of GER.
BLAS(bool use_default_impl=true, bool use_dynamic=true, OrdinalType static_workspace_size=0)
Default constructor.