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 // @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_BLAS_HPP
11 #define SACADO_FAD_BLAS_HPP
12 
13 #include "Teuchos_BLAS.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 FadType& a, OrdinalType& n_dot, ValueType& val,
39  const ValueType*& dot) const;
40 
41  void unpack(const FadType* a, OrdinalType n, OrdinalType inc,
42  OrdinalType& n_dot, OrdinalType& inc_val,
43  OrdinalType& inc_dot,
44  const ValueType*& val, const ValueType*& dot) const;
45 
46  void unpack(const FadType* A, OrdinalType m, OrdinalType n,
47  OrdinalType lda, OrdinalType& n_dot,
48  OrdinalType& lda_val, OrdinalType& lda_dot,
49  const ValueType*& val, const ValueType*& dot) const;
50 
51  void unpack(const ValueType& a, OrdinalType& n_dot, ValueType& val,
52  const ValueType*& dot) const;
53 
54  void unpack(const ValueType* a, OrdinalType n, OrdinalType inc,
55  OrdinalType& n_dot, OrdinalType& inc_val,
56  OrdinalType& inc_dot,
57  const ValueType*& val, const ValueType*& dot) const;
58 
59  void unpack(const ValueType* A, OrdinalType m, OrdinalType n,
60  OrdinalType lda, OrdinalType& n_dot,
61  OrdinalType& lda_val, OrdinalType& lda_dot,
62  const ValueType*& val, const ValueType*& dot) const;
63 
64  void unpack(const ScalarType& a, OrdinalType& n_dot, ScalarType& val,
65  const ScalarType*& dot) const;
66 
67  void unpack(const ScalarType* a, OrdinalType n, OrdinalType inc,
68  OrdinalType& n_dot, OrdinalType& inc_val,
69  OrdinalType& inc_dot,
70  const ScalarType*& val, const ScalarType*& dot) const;
71 
72  void unpack(const ScalarType* A, OrdinalType m, OrdinalType n,
73  OrdinalType lda, OrdinalType& n_dot,
74  OrdinalType& lda_val, OrdinalType& lda_dot,
75  const ScalarType*& val, const ScalarType*& dot) const;
76 
77  void unpack(FadType& a, OrdinalType& n_dot, OrdinalType& final_n_dot,
78  ValueType& val, ValueType*& dot) const;
79 
80  void unpack(FadType* a, OrdinalType n, OrdinalType inc,
81  OrdinalType& n_dot, OrdinalType& final_n_dot,
82  OrdinalType& inc_val, OrdinalType& inc_dot,
83  ValueType*& val, ValueType*& dot) const;
84 
85  void unpack(FadType* A, OrdinalType m, OrdinalType n, OrdinalType lda,
86  OrdinalType& n_dot, OrdinalType& final_n_dot,
87  OrdinalType& lda_val, OrdinalType& lda_dot,
88  ValueType*& val, ValueType*& dot) const;
89 
90  void pack(FadType& a, OrdinalType n_dot, const ValueType& val,
91  const ValueType* dot) const;
92 
93  void pack(FadType* a, OrdinalType n, OrdinalType inc,
94  OrdinalType n_dot, OrdinalType inc_val, OrdinalType inc_dot,
95  const ValueType* val, const ValueType* dot) const;
96 
97  void pack(FadType* A, OrdinalType m, OrdinalType n,
98  OrdinalType lda, OrdinalType n_dot,
99  OrdinalType lda_val, OrdinalType lda_dot,
100  const ValueType* val, const ValueType* dot) const;
101 
102  void free(const FadType& a, OrdinalType n_dot,
103  const ValueType* dot) const;
104 
105  void free(const FadType* a, OrdinalType n, OrdinalType n_dot,
106  OrdinalType inc_val, OrdinalType inc_dot,
107  const ValueType* val, const ValueType* dot) const;
108 
109  void free(const FadType* A, OrdinalType m, OrdinalType n,
110  OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
111  const ValueType* val, const ValueType* dot) const;
112 
113  void free(const ValueType& a, OrdinalType n_dot,
114  const ValueType* dot) const {}
115 
116  void free(const ValueType* a, OrdinalType n, OrdinalType n_dot,
117  OrdinalType inc_val, OrdinalType inc_dot,
118  const ValueType* val, const ValueType* dot) const {}
119 
120  void free(const ValueType* A, OrdinalType m, OrdinalType n,
121  OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
122  const ValueType* val, const ValueType* dot) const {}
123 
124  void free(const ScalarType& a, OrdinalType n_dot,
125  const ScalarType* dot) const {}
126 
127  void free(const ScalarType* a, OrdinalType n, OrdinalType n_dot,
128  OrdinalType inc_val, OrdinalType inc_dot,
129  const ScalarType* val, const ScalarType* dot) const {}
130 
131  void free(const ScalarType* A, OrdinalType m, OrdinalType n,
132  OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
133  const ScalarType* val, const ScalarType* dot) const {}
134 
135  ValueType* allocate_array(OrdinalType size) const;
136 
137  void free_array(const ValueType* ptr, OrdinalType size) const;
138 
139  bool is_array_contiguous(const FadType* a, OrdinalType n,
140  OrdinalType n_dot) const;
141 
142  protected:
143 
146 
148  OrdinalType workspace_size;
149 
152 
155 
156  };
157 
158  template <typename T> struct ArrayValueType { typedef T type; };
159 
161  template <typename OrdinalType, typename FadType>
162  class BLAS : public Teuchos::DefaultBLASImpl<OrdinalType,FadType> {
163 
169 
170  public:
172 
173 
175  BLAS(bool use_default_impl = true,
176  bool use_dynamic = true, OrdinalType static_workspace_size = 0);
177 
179 
180  BLAS(const BLAS& x);
181 
183  virtual ~BLAS();
184 
186 
188 
189 
191  void ROTG(FadType* da, FadType* db, MagnitudeType* c, FadType* s) const {
192  BLASType::ROTG(da,db,c,s);
193  }
194 
196  void ROT(const OrdinalType n, FadType* dx, const OrdinalType incx,
197  FadType* dy, const OrdinalType incy, MagnitudeType* c,
198  FadType* s) const {
199  BLASType::ROT(n,dx,incx,dy,incy,c,s);
200  }
201 
203  void SCAL(const OrdinalType n, const FadType& alpha, FadType* x,
204  const OrdinalType incx) const;
205 
207  void COPY(const OrdinalType n, const FadType* x,
208  const OrdinalType incx, FadType* y,
209  const OrdinalType incy) const;
210 
212  template <typename alpha_type, typename x_type>
213  void AXPY(const OrdinalType n, const alpha_type& alpha,
214  const x_type* x, const OrdinalType incx, FadType* y,
215  const OrdinalType incy) const;
216 
219  ASUM(const OrdinalType n, const FadType* x,
220  const OrdinalType incx) const {
221  return BLASType::ASUM(n,x,incx);
222  }
223 
225  template <typename x_type, typename y_type>
226  FadType DOT(const OrdinalType n, const x_type* x,
227  const OrdinalType incx, const y_type* y,
228  const OrdinalType incy) const;
229 
231  MagnitudeType NRM2(const OrdinalType n, const FadType* x,
232  const OrdinalType incx) const;
233 
235  OrdinalType IAMAX(const OrdinalType n, const FadType* x,
236  const OrdinalType incx) const {
237  return BLASType::IAMAX(n,x,incx);
238  }
239 
241 
243 
244 
250  template <typename alpha_type, typename A_type, typename x_type,
251  typename beta_type>
252  void GEMV(Teuchos::ETransp trans, const OrdinalType m,
253  const OrdinalType n,
254  const alpha_type& alpha, const A_type* A,
255  const OrdinalType lda, const x_type* x,
256  const OrdinalType incx, const beta_type& beta,
257  FadType* y, const OrdinalType incy) const;
258 
264  template <typename A_type>
265  void TRMV(Teuchos::EUplo uplo, Teuchos::ETransp trans,
266  Teuchos::EDiag diag, const OrdinalType n,
267  const A_type* A, const OrdinalType lda, FadType* x,
268  const OrdinalType incx) const;
269 
271  template <typename alpha_type, typename x_type, typename y_type>
272  void GER(const OrdinalType m, const OrdinalType n,
273  const alpha_type& alpha,
274  const x_type* x, const OrdinalType incx,
275  const y_type* y, const OrdinalType incy,
276  FadType* A, const OrdinalType lda) const;
277 
279 
281 
282 
289  template <typename alpha_type, typename A_type, typename B_type,
290  typename beta_type>
291  void GEMM(Teuchos::ETransp transa, Teuchos::ETransp transb,
292  const OrdinalType m, const OrdinalType n, const OrdinalType k,
293  const alpha_type& alpha, const A_type* A, const OrdinalType lda,
294  const B_type* B, const OrdinalType ldb, const beta_type& beta,
295  FadType* C, const OrdinalType ldc) const;
296 
303  template <typename alpha_type, typename A_type, typename B_type,
304  typename beta_type>
305  void SYMM(Teuchos::ESide side, Teuchos::EUplo uplo, const OrdinalType m,
306  const OrdinalType n,
307  const alpha_type& alpha, const A_type* A,
308  const OrdinalType lda, const B_type* B,
309  const OrdinalType ldb,
310  const beta_type& beta, FadType* C,
311  const OrdinalType ldc) const;
312 
319  template <typename alpha_type, typename A_type>
320  void TRMM(Teuchos::ESide side, Teuchos::EUplo uplo,
321  Teuchos::ETransp transa, Teuchos::EDiag diag,
322  const OrdinalType m, const OrdinalType n,
323  const alpha_type& alpha,
324  const A_type* A, const OrdinalType lda,
325  FadType* B, const OrdinalType ldb) const;
326 
334  template <typename alpha_type, typename A_type>
335  void TRSM(Teuchos::ESide side, Teuchos::EUplo uplo,
336  Teuchos::ETransp transa, Teuchos::EDiag diag,
337  const OrdinalType m, const OrdinalType n,
338  const alpha_type& alpha,
339  const A_type* A, const OrdinalType lda,
340  FadType* B, const OrdinalType ldb) const;
341 
343 
344  protected:
345 
348 
351 
354 
356  mutable std::vector<ValueType> gemv_Ax;
357 
359  mutable std::vector<ValueType> gemm_AB;
360 
361  protected:
362 
364  template <typename x_type, typename y_type>
365  void Fad_DOT(const OrdinalType n,
366  const x_type* x,
367  const OrdinalType incx,
368  const OrdinalType n_x_dot,
369  const x_type* x_dot,
370  const OrdinalType incx_dot,
371  const y_type* y,
372  const OrdinalType incy,
373  const OrdinalType n_y_dot,
374  const y_type* y_dot,
375  const OrdinalType incy_dot,
376  ValueType& z,
377  const OrdinalType n_z_dot,
378  ValueType* zdot) const;
379 
381  template <typename alpha_type, typename A_type, typename x_type,
382  typename beta_type>
383  void Fad_GEMV(Teuchos::ETransp trans,
384  const OrdinalType m,
385  const OrdinalType n,
386  const alpha_type& alpha,
387  const OrdinalType n_alpha_dot,
388  const alpha_type* alpha_dot,
389  const A_type* A,
390  const OrdinalType lda,
391  const OrdinalType n_A_dot,
392  const A_type* A_dot,
393  const OrdinalType lda_dot,
394  const x_type* x,
395  const OrdinalType incx,
396  const OrdinalType n_x_dot,
397  const x_type* x_dot,
398  const OrdinalType incx_dot,
399  const beta_type& beta,
400  const OrdinalType n_beta_dot,
401  const beta_type* beta_dot,
402  ValueType* y,
403  const OrdinalType incy,
404  const OrdinalType n_y_dot,
405  ValueType* y_dot,
406  const OrdinalType incy_dot,
407  const OrdinalType n_dot) const;
408 
410  template <typename alpha_type, typename x_type, typename y_type>
411  void Fad_GER(const OrdinalType m,
412  const OrdinalType n,
413  const alpha_type& alpha,
414  const OrdinalType n_alpha_dot,
415  const alpha_type* alpha_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 y_type* y,
422  const OrdinalType incy,
423  const OrdinalType n_y_dot,
424  const y_type* y_dot,
425  const OrdinalType incy_dot,
426  ValueType* A,
427  const OrdinalType lda,
428  const OrdinalType n_A_dot,
429  ValueType* A_dot,
430  const OrdinalType lda_dot,
431  const OrdinalType n_dot) const;
432 
434  template <typename alpha_type, typename A_type, typename B_type,
435  typename beta_type>
436  void Fad_GEMM(Teuchos::ETransp transa,
437  Teuchos::ETransp transb,
438  const OrdinalType m,
439  const OrdinalType n,
440  const OrdinalType k,
441  const alpha_type& alpha,
442  const OrdinalType n_alpha_dot,
443  const alpha_type* alpha_dot,
444  const A_type* A,
445  const OrdinalType lda,
446  const OrdinalType n_A_dot,
447  const A_type* A_dot,
448  const OrdinalType lda_dot,
449  const B_type* B,
450  const OrdinalType ldb,
451  const OrdinalType n_B_dot,
452  const B_type* B_dot,
453  const OrdinalType ldb_dot,
454  const beta_type& beta,
455  const OrdinalType n_beta_dot,
456  const beta_type* beta_dot,
457  ValueType* C,
458  const OrdinalType ldc,
459  const OrdinalType n_C_dot,
460  ValueType* C_dot,
461  const OrdinalType ldc_dot,
462  const OrdinalType n_dot) const;
463 
465  template <typename alpha_type, typename A_type, typename B_type,
466  typename beta_type>
467  void Fad_SYMM(Teuchos::ESide side,
468  Teuchos::EUplo uplo,
469  const OrdinalType m,
470  const OrdinalType n,
471  const alpha_type& alpha,
472  const OrdinalType n_alpha_dot,
473  const alpha_type* alpha_dot,
474  const A_type* A,
475  const OrdinalType lda,
476  const OrdinalType n_A_dot,
477  const A_type* A_dot,
478  const OrdinalType lda_dot,
479  const B_type* B,
480  const OrdinalType ldb,
481  const OrdinalType n_B_dot,
482  const B_type* B_dot,
483  const OrdinalType ldb_dot,
484  const beta_type& beta,
485  const OrdinalType n_beta_dot,
486  const beta_type* beta_dot,
487  ValueType* C,
488  const OrdinalType ldc,
489  const OrdinalType n_C_dot,
490  ValueType* C_dot,
491  const OrdinalType ldc_dot,
492  const OrdinalType n_dot) const;
493 
495  template <typename alpha_type, typename A_type>
496  void Fad_TRMM(Teuchos::ESide side,
497  Teuchos::EUplo uplo,
498  Teuchos::ETransp transa,
499  Teuchos::EDiag diag,
500  const OrdinalType m,
501  const OrdinalType n,
502  const alpha_type& alpha,
503  const OrdinalType n_alpha_dot,
504  const alpha_type* alpha_dot,
505  const A_type* A,
506  const OrdinalType lda,
507  const OrdinalType n_A_dot,
508  const A_type* A_dot,
509  const OrdinalType lda_dot,
510  ValueType* B,
511  const OrdinalType ldb,
512  const OrdinalType n_B_dot,
513  ValueType* B_dot,
514  const OrdinalType ldb_dot,
515  const OrdinalType n_dot) const;
516 
518  template <typename alpha_type, typename A_type>
519  void Fad_TRSM(Teuchos::ESide side,
520  Teuchos::EUplo uplo,
521  Teuchos::ETransp transa,
522  Teuchos::EDiag diag,
523  const OrdinalType m,
524  const OrdinalType n,
525  const alpha_type& alpha,
526  const OrdinalType n_alpha_dot,
527  const alpha_type* alpha_dot,
528  const A_type* A,
529  const OrdinalType lda,
530  const OrdinalType n_A_dot,
531  const A_type* A_dot,
532  const OrdinalType lda_dot,
533  ValueType* B,
534  const OrdinalType ldb,
535  const OrdinalType n_B_dot,
536  ValueType* B_dot,
537  const OrdinalType ldb_dot,
538  const OrdinalType n_dot) const;
539 
540  }; // class FadBLAS
541 
542  } // namespace Fad
543 
544  // template <typename FadType> ArrayValueType<FadType> { typedef ValueType type; };
545  // template <> ArrayValueType<ValueType> { typedef ValueType type; };
546  // template <> ArrayValueType<ScalarType> { typedef ScalarType type; };
547 
548 } // namespace Sacado
549 
550 // Here we provide partial specializations for Teuchos::BLAS for each Fad type
551 #define TEUCHOS_BLAS_FAD_SPEC(FADTYPE) \
552 namespace Teuchos { \
553  template <typename OrdinalType, typename ValueT> \
554  class BLAS< OrdinalType, FADTYPE<ValueT> > : \
555  public Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> > { \
556  public: \
557  BLAS(bool use_default_impl = true, bool use_dynamic = true, \
558  OrdinalType static_workspace_size = 0) : \
559  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> >( \
560  use_default_impl, use_dynamic,static_workspace_size) {} \
561  BLAS(const BLAS& x) : \
562  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> >(x) {} \
563  virtual ~BLAS() {} \
564  }; \
565 } \
566 namespace Sacado { \
567  namespace Fad { \
568  template <typename ValueT> \
569  struct ArrayValueType< FADTYPE<ValueT> > { \
570  typedef ValueT type; \
571  }; \
572  } \
573 }
574 #define TEUCHOS_BLAS_SFAD_SPEC(FADTYPE) \
575 namespace Teuchos { \
576  template <typename OrdinalType, typename ValueT, int Num> \
577  class BLAS< OrdinalType, FADTYPE<ValueT,Num> > : \
578  public Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> > { \
579  public: \
580  BLAS(bool use_default_impl = true, bool use_dynamic = true, \
581  OrdinalType static_workspace_size = 0) : \
582  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> >( \
583  use_default_impl, use_dynamic, static_workspace_size) {} \
584  BLAS(const BLAS& x) : \
585  Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> >(x) {} \
586  virtual ~BLAS() {} \
587  }; \
588 } \
589 namespace Sacado { \
590  namespace Fad { \
591  template <typename ValueT, int Num> \
592  struct ArrayValueType< FADTYPE<ValueT,Num> > { \
593  typedef ValueT type; \
594  }; \
595  } \
596 }
598 TEUCHOS_BLAS_SFAD_SPEC(Sacado::Fad::SFad)
599 TEUCHOS_BLAS_SFAD_SPEC(Sacado::Fad::SLFad)
600 TEUCHOS_BLAS_FAD_SPEC(Sacado::Fad::DVFad)
601 TEUCHOS_BLAS_FAD_SPEC(Sacado::ELRFad::DFad)
602 TEUCHOS_BLAS_SFAD_SPEC(Sacado::ELRFad::SFad)
603 TEUCHOS_BLAS_SFAD_SPEC(Sacado::ELRFad::SLFad)
604 TEUCHOS_BLAS_FAD_SPEC(Sacado::CacheFad::DFad)
605 
606 #undef TEUCHOS_BLAS_FAD_SPEC
607 #undef TEUCHOS_BLAS_SFAD_SPEC
608 
609 #include "Sacado_Fad_BLASImp.hpp"
610 
611 #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;...
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:553
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
Uncopyable z
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.
const double y
BLAS(bool use_default_impl=true, bool use_dynamic=true, OrdinalType static_workspace_size=0)
Default constructor.