This file is indexed.

/usr/include/trilinos/Sacado_Fad_BLAS.hpp is in libtrilinos-sacado-dev 12.12.1-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
// $Id$ 
// $Source$ 
// @HEADER
// ***********************************************************************
// 
//                           Sacado Package
//                 Copyright (2006) Sandia Corporation
// 
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
// 
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//  
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//  
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
// USA
// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
// (etphipp@sandia.gov).
// 
// ***********************************************************************
// @HEADER

#ifndef SACADO_FAD_BLAS_HPP
#define SACADO_FAD_BLAS_HPP

#include "Teuchos_BLAS.hpp"
#include "Sacado_No_Kokkos.hpp"
#include "Sacado_CacheFad_DFad.hpp"
#include "Sacado_dummy_arg.hpp"

namespace Sacado {

  namespace Fad {

    template <typename OrdinalType, typename FadType>
    class ArrayTraits {

      typedef typename Sacado::ValueType<FadType>::type ValueType;
      typedef typename Sacado::ScalarType<FadType>::type scalar_type;
      typedef typename Sacado::dummy<ValueType,scalar_type>::type ScalarType;
      
    public:
      
      ArrayTraits(bool use_dynamic = true,
		  OrdinalType workspace_size = 0);

      ArrayTraits(const ArrayTraits& a);

      ~ArrayTraits();
      
      void unpack(const FadType& a, OrdinalType& n_dot, ValueType& val, 
		  const ValueType*& dot) const;
      
      void unpack(const FadType* a, OrdinalType n, OrdinalType inc,
		  OrdinalType& n_dot, OrdinalType& inc_val, 
		  OrdinalType& inc_dot,
		  const ValueType*& val, const ValueType*& dot) const;
      
      void unpack(const FadType* A, OrdinalType m, OrdinalType n, 
		  OrdinalType lda, OrdinalType& n_dot, 
		  OrdinalType& lda_val, OrdinalType& lda_dot,
		  const ValueType*& val, const ValueType*& dot) const;

      void unpack(const ValueType& a, OrdinalType& n_dot, ValueType& val, 
		  const ValueType*& dot) const;
      
      void unpack(const ValueType* a, OrdinalType n, OrdinalType inc,
		  OrdinalType& n_dot, OrdinalType& inc_val, 
		  OrdinalType& inc_dot,
		  const ValueType*& val, const ValueType*& dot) const;
      
      void unpack(const ValueType* A, OrdinalType m, OrdinalType n, 
		  OrdinalType lda, OrdinalType& n_dot, 
		  OrdinalType& lda_val, OrdinalType& lda_dot,
		  const ValueType*& val, const ValueType*& dot) const;

      void unpack(const ScalarType& a, OrdinalType& n_dot, ScalarType& val, 
		  const ScalarType*& dot) const;
      
      void unpack(const ScalarType* a, OrdinalType n, OrdinalType inc,
		  OrdinalType& n_dot, OrdinalType& inc_val, 
		  OrdinalType& inc_dot,
		  const ScalarType*& val, const ScalarType*& dot) const;
      
      void unpack(const ScalarType* A, OrdinalType m, OrdinalType n, 
		  OrdinalType lda, OrdinalType& n_dot, 
		  OrdinalType& lda_val, OrdinalType& lda_dot,
		  const ScalarType*& val, const ScalarType*& dot) const;

      void unpack(FadType& a, OrdinalType& n_dot, OrdinalType& final_n_dot, 
		  ValueType& val, ValueType*& dot) const;
      
      void unpack(FadType* a, OrdinalType n, OrdinalType inc,
		  OrdinalType& n_dot, OrdinalType& final_n_dot, 
		  OrdinalType& inc_val, OrdinalType& inc_dot,
		  ValueType*& val, ValueType*& dot) const;
      
      void unpack(FadType* A, OrdinalType m, OrdinalType n, OrdinalType lda, 
		  OrdinalType& n_dot, OrdinalType& final_n_dot, 
		  OrdinalType& lda_val, OrdinalType& lda_dot,
		  ValueType*& val, ValueType*& dot) const;

      void pack(FadType& a, OrdinalType n_dot, const ValueType& val, 
		const ValueType* dot) const;
      
      void pack(FadType* a, OrdinalType n, OrdinalType inc,
		OrdinalType n_dot, OrdinalType inc_val, OrdinalType inc_dot,
		const ValueType* val, const ValueType* dot) const;
      
      void pack(FadType* A, OrdinalType m, OrdinalType n, 
		OrdinalType lda, OrdinalType n_dot, 
		OrdinalType lda_val, OrdinalType lda_dot,
		const ValueType* val, const ValueType* dot) const;

      void free(const FadType& a, OrdinalType n_dot, 
		const ValueType* dot) const;
      
      void free(const FadType* a, OrdinalType n, OrdinalType n_dot,
		OrdinalType inc_val, OrdinalType inc_dot,
		const ValueType* val, const ValueType* dot) const;

      void free(const FadType* A, OrdinalType m, OrdinalType n, 
		OrdinalType n_dot, OrdinalType lda_val, OrdinalType lda_dot,
		const ValueType* val, const ValueType* dot) const;

      void free(const ValueType& a, OrdinalType n_dot, 
		const ValueType* dot) const {}
      
      void free(const ValueType* a, OrdinalType n, OrdinalType n_dot,
		OrdinalType inc_val, OrdinalType inc_dot,
		const ValueType* val, const ValueType* dot) const {}

      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 {}

      void free(const ScalarType& a, OrdinalType n_dot, 
		const ScalarType* dot) const {}
      
      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 {}

      ValueType* allocate_array(OrdinalType size) const;

      void free_array(const ValueType* ptr, OrdinalType size) const;

      bool is_array_contiguous(const FadType* a, OrdinalType n, 
			       OrdinalType n_dot) const;

    protected:

      //! Use dynamic memory allocation
      bool use_dynamic;

      //! Size of static workspace
      OrdinalType workspace_size;

      //! Workspace for holding contiguous values/derivatives
      mutable ValueType *workspace;

      //! Pointer to current free entry in workspace
      mutable ValueType *workspace_pointer;
		
    };

    template <typename T> struct ArrayValueType { typedef T type; };

    //! Fad specializations for Teuchos::BLAS wrappers
    template <typename OrdinalType, typename FadType>
    class BLAS : public Teuchos::DefaultBLASImpl<OrdinalType,FadType> {    
      
      typedef typename Teuchos::ScalarTraits<FadType>::magnitudeType MagnitudeType;
      typedef typename Sacado::ValueType<FadType>::type ValueType;
      typedef typename Sacado::ScalarType<FadType>::type scalar_type;
      typedef typename Sacado::dummy<ValueType,scalar_type>::type ScalarType;
      typedef Teuchos::DefaultBLASImpl<OrdinalType,FadType> BLASType;
    
    public:
      //! @name Constructor/Destructor.
      //@{ 
    
      //! Default constructor.
      BLAS(bool use_default_impl = true,
	   bool use_dynamic = true, OrdinalType static_workspace_size = 0);

      //! Copy constructor.

      BLAS(const BLAS& x);

      //! Destructor.
      virtual ~BLAS();

      //@}
      
      //! @name Level 1 BLAS Routines.
      //@{ 
      
      //! Computes a Givens plane rotation.
      void ROTG(FadType* da, FadType* db, MagnitudeType* c, FadType* s) const { 
	BLASType::ROTG(da,db,c,s); 
      }
      
      //! Applies a Givens plane rotation.
      void ROT(const OrdinalType n, FadType* dx, const OrdinalType incx, 
	       FadType* dy, const OrdinalType incy, MagnitudeType* c, 
	       FadType* s) const { 
	BLASType::ROT(n,dx,incx,dy,incy,c,s); 
      }
      
      //! Scale the std::vector \c x by the constant \c alpha.
      void SCAL(const OrdinalType n, const FadType& alpha, FadType* x, 
		const OrdinalType incx) const;

      //! Copy the std::vector \c x to the std::vector \c y.
      void COPY(const OrdinalType n, const FadType* x, 
		const OrdinalType incx, FadType* y, 
		const OrdinalType incy) const;

      //! Perform the operation: \c y \c <- \c y+alpha*x.
      template <typename alpha_type, typename x_type>
      void AXPY(const OrdinalType n, const alpha_type& alpha, 
		const x_type* x, const OrdinalType incx, FadType* y, 
		const OrdinalType incy) const;

      //! Sum the absolute values of the entries of \c x.
      typename Teuchos::ScalarTraits<FadType>::magnitudeType 
      ASUM(const OrdinalType n, const FadType* x, 
	   const OrdinalType incx) const {
	return BLASType::ASUM(n,x,incx);
      }

      //! Form the dot product of the vectors \c x and \c y.
      template <typename x_type, typename y_type>
      FadType DOT(const OrdinalType n, const x_type* x, 
		  const OrdinalType incx, const y_type* y, 
		  const OrdinalType incy) const;

      //! Compute the 2-norm of the std::vector \c x.
      MagnitudeType NRM2(const OrdinalType n, const FadType* x, 
			 const OrdinalType incx) const;

      //! Return the index of the element of \c x with the maximum magnitude.
      OrdinalType IAMAX(const OrdinalType n, const FadType* x, 
			const OrdinalType incx) const {
	return BLASType::IAMAX(n,x,incx); 
      }

      //@}
      
      //! @name Level 2 BLAS Routines.
      //@{ 
      
      /*! 
       * \brief Performs the matrix-std::vector operation:  
       * \c y \c <- \c alpha*A*x+beta*y or \c y \c <- \c alpha*A'*x+beta*y 
       * where \c A is a general \c m by \c n matrix.
       */
      template <typename alpha_type, typename A_type, typename x_type,
		typename beta_type>
      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;

      /*!
       * \brief Performs the matrix-std::vector operation:  
       * \c x \c <- \c A*x or \c x \c <- \c A'*x where \c A is a unit/non-unit 
       * \c n by \c n upper/lower triangular matrix.
       */
      template <typename A_type>
      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 rank 1 operation:  \c A \c <- \c alpha*x*y'+A. 
      template <typename alpha_type, typename x_type, typename y_type>
      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;
      
      //@}
      
      //! @name Level 3 BLAS Routines. 
      //@{ 
      
      /*! 
       * \brief Performs the matrix-matrix operation: 
       * \c C \c <- \c alpha*op(A)*op(B)+beta*C where \c op(A) is either \c A 
       * or \c A', \c op(B) is either \c B or \c B', and C is an \c m by \c k 
       * matrix.
       */
      template <typename alpha_type, typename A_type, typename B_type,
		typename beta_type>
      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;
      
      /*!
       * \brief Performs the matrix-matrix operation: 
       * \c C \c <- \c alpha*A*B+beta*C or \c C \c <- \c alpha*B*A+beta*C where 
       * \c A is an \c m by \c m or \c n by \c n symmetric matrix and \c B is a 
       * general matrix.
       */
      template <typename alpha_type, typename A_type, typename B_type,
		typename beta_type>
      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;
      
      /*!
       * \brief Performs the matrix-matrix operation: 
       * \c C \c <- \c alpha*op(A)*B+beta*C or 
       * \c C \c <- \c alpha*B*op(A)+beta*C where \c op(A) is an unit/non-unit, 
       * upper/lower triangular matrix and \c B is a general matrix.
       */
      template <typename alpha_type, typename A_type>
      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;

      /*! 
       * \brief Solves the matrix equations:  
       * \c op(A)*X=alpha*B or \c X*op(A)=alpha*B where \c X and \c B are \c m 
       * by \c n matrices, \c A is a unit/non-unit, upper/lower triangular 
       * matrix and \c op(A) is \c A or \c A'.  The matrix \c X is overwritten 
       * on \c B.
       */
      template <typename alpha_type, typename A_type>
      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;

      //@}

    protected:

      //! ArrayTraits for packing/unpacking value/derivative arrays
      ArrayTraits<OrdinalType,FadType> arrayTraits;

      //! BLAS for values
      Teuchos::BLAS<OrdinalType, ValueType> blas;

      //! Use custom or default implementation
      bool use_default_impl;
      
      //! Temporary array for GEMV
      mutable std::vector<ValueType> gemv_Ax;

      //! Temporary array for GEMM
      mutable std::vector<ValueType> gemm_AB;

    protected:

      //! Implementation of DOT
      template <typename x_type, typename y_type>
      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 GEMV
      template <typename alpha_type, typename A_type, typename x_type,
		typename beta_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 GER
      template <typename alpha_type, typename x_type, typename y_type>
      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 GEMM
      template <typename alpha_type, typename A_type, typename B_type,
		typename beta_type>
      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 SYMM
      template <typename alpha_type, typename A_type, typename B_type,
		typename beta_type>
      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 TRMM
      template <typename alpha_type, typename A_type>
      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
      template <typename alpha_type, typename A_type>
      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;

    }; // class FadBLAS

  }  // namespace Fad

  // template <typename FadType> ArrayValueType<FadType> { typedef ValueType type; };
  // template <> ArrayValueType<ValueType> { typedef ValueType type; };
  // template <> ArrayValueType<ScalarType> { typedef ScalarType type; };

} // namespace Sacado

// Here we provide partial specializations for Teuchos::BLAS for each Fad type
#define TEUCHOS_BLAS_FAD_SPEC(FADTYPE)					\
namespace Teuchos {							\
  template <typename OrdinalType, typename ValueT>			\
  class BLAS< OrdinalType, FADTYPE<ValueT> > :				\
    public Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> > {		\
  public:								\
    BLAS(bool use_default_impl = true,	bool use_dynamic = true,	\
	 OrdinalType static_workspace_size = 0) :			\
      Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> >(		\
	use_default_impl, use_dynamic,static_workspace_size) {}		\
    BLAS(const BLAS& x) :						\
      Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT> >(x) {}		\
    virtual ~BLAS() {}							\
  };									\
}									\
namespace Sacado {							\
  namespace Fad {							\
    template <typename ValueT>						\
    struct ArrayValueType< FADTYPE<ValueT> > {				\
      typedef ValueT type;						\
    };									\
  }									\
}
#define TEUCHOS_BLAS_SFAD_SPEC(FADTYPE)					\
namespace Teuchos {							\
  template <typename OrdinalType, typename ValueT, int Num>		\
  class BLAS< OrdinalType, FADTYPE<ValueT,Num> > :			\
    public Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> > {	\
  public:								\
    BLAS(bool use_default_impl = true,	bool use_dynamic = true,	\
	 OrdinalType static_workspace_size = 0) :			\
      Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> >(		\
	use_default_impl, use_dynamic, static_workspace_size) {}	\
    BLAS(const BLAS& x) :						\
      Sacado::Fad::BLAS< OrdinalType, FADTYPE<ValueT,Num> >(x) {}	\
    virtual ~BLAS() {}							\
  };									\
}									\
namespace Sacado {							\
  namespace Fad {							\
    template <typename ValueT, int Num>					\
    struct ArrayValueType< FADTYPE<ValueT,Num> > {			\
      typedef ValueT type;						\
    };									\
  }									\
}
TEUCHOS_BLAS_FAD_SPEC(Sacado::Fad::DFad)
TEUCHOS_BLAS_SFAD_SPEC(Sacado::Fad::SFad)
TEUCHOS_BLAS_SFAD_SPEC(Sacado::Fad::SLFad)
TEUCHOS_BLAS_FAD_SPEC(Sacado::Fad::DMFad)
TEUCHOS_BLAS_FAD_SPEC(Sacado::Fad::DVFad)
TEUCHOS_BLAS_FAD_SPEC(Sacado::ELRFad::DFad)
TEUCHOS_BLAS_SFAD_SPEC(Sacado::ELRFad::SFad)
TEUCHOS_BLAS_SFAD_SPEC(Sacado::ELRFad::SLFad)
TEUCHOS_BLAS_FAD_SPEC(Sacado::CacheFad::DFad)

#undef TEUCHOS_BLAS_FAD_SPEC
#undef TEUCHOS_BLAS_SFAD_SPEC

#include "Sacado_Fad_BLASImp.hpp"

#endif // SACADO_FAD_BLAS_HPP