example/BLAS/cxx_main.cpp

Go to the documentation of this file.
00001 #include "Teuchos_BLAS.hpp"
00002 #include "Teuchos_Version.hpp"
00003 
00004 int main(int argc, char* argv[])
00005 {
00006   std::cout << Teuchos::Teuchos_Version() << std::endl << std::endl;
00007 
00008   // Creating an instance of the BLAS class for double-precision kernels looks like:
00009   Teuchos::BLAS<int, double> blas;
00010 
00011   // This instance provides the access to all the BLAS kernels listed in Figure \ref{blas_kernels}:
00012   const int n = 10;
00013   double alpha = 2.0;
00014   double x[ n ];
00015   for ( int i=0; i<n; i++ ) { x[i] = i; }
00016   blas.SCAL( n, alpha, x, 1 );
00017   int max_idx = blas.IAMAX( n, x, 1 );
00018   std::cout<< "The index of the maximum magnitude entry of x[] is the "
00019       <<  max_idx <<"-th and x[ " << max_idx-1 << " ] = "<< x[max_idx-1] 
00020       << std::endl;
00021   
00022   return 0;
00023 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 09:57:28 2011 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.3