Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
numerics/example/BLAS/cxx_main.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #include "Teuchos_BLAS.hpp"
11 #include "Teuchos_Version.hpp"
12 
13 int main(int argc, char* argv[])
14 {
15  std::cout << Teuchos::Teuchos_Version() << std::endl << std::endl;
16 
17  // Creating an instance of the BLAS class for double-precision kernels looks like:
19 
20  // This instance provides the access to all the BLAS kernels listed in Figure \ref{blas_kernels}:
21  const int n = 10;
22  double alpha = 2.0;
23  double x[ n ];
24  for ( int i=0; i<n; i++ ) { x[i] = i; }
25  blas.SCAL( n, alpha, x, 1 );
26  int max_idx = blas.IAMAX( n, x, 1 );
27  std::cout<< "The index of the maximum magnitude entry of x[] is the "
28  << max_idx <<"-th and x[ " << max_idx-1 << " ] = "<< x[max_idx-1]
29  << std::endl;
30 
31  return 0;
32 }
Templated interface class to BLAS routines.
std::string Teuchos_Version()
int main(int argc, char *argv[])
int IAMAX(const int &n, const double *x, const int &incx) const
void SCAL(const int &n, const double &alpha, double *x, const int &incx) const