ViennaCL - The Vienna Computing Library  1.5.2
viennacl/linalg/norm_frobenius.hpp
Go to the documentation of this file.
00001 #ifndef VIENNACL_LINALG_NORM_FROBENIUS_HPP_
00002 #define VIENNACL_LINALG_NORM_FROBENIUS_HPP_
00003 
00004 /* =========================================================================
00005    Copyright (c) 2010-2014, Institute for Microelectronics,
00006                             Institute for Analysis and Scientific Computing,
00007                             TU Wien.
00008    Portions of this software are copyright by UChicago Argonne, LLC.
00009 
00010                             -----------------
00011                   ViennaCL - The Vienna Computing Library
00012                             -----------------
00013 
00014    Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at
00015 
00016    (A list of authors and contributors can be found in the PDF manual)
00017 
00018    License:         MIT (X11), see file LICENSE in the base directory
00019 ============================================================================= */
00020 
00025 #include <cmath>
00026 #include "viennacl/forwards.h"
00027 #include "viennacl/tools/tools.hpp"
00028 #include "viennacl/meta/enable_if.hpp"
00029 #include "viennacl/meta/tag_of.hpp"
00030 
00031 namespace viennacl
00032 {
00033   //
00034   // generic norm_frobenius function
00035   //   uses tag dispatch to identify which algorithm
00036   //   should be called
00037   //
00038   namespace linalg
00039   {
00040 
00041     #ifdef VIENNACL_WITH_UBLAS
00042     // ----------------------------------------------------
00043     // UBLAS
00044     //
00045     template< typename VectorT >
00046     typename viennacl::enable_if< viennacl::is_ublas< typename viennacl::traits::tag_of< VectorT >::type >::value,
00047                                   typename VectorT::value_type
00048                                 >::type
00049     norm_frobenius(VectorT const& v1)
00050     {
00051       return boost::numeric::ublas::norm_frobenius(v1);
00052     }
00053     #endif
00054 
00055 
00056     // ----------------------------------------------------
00057     // VIENNACL
00058     //
00059     template<typename NumericT, typename F>
00060     scalar_expression< const matrix_base<NumericT, F>, const matrix_base<NumericT, F>, op_norm_frobenius>
00061     norm_frobenius(const matrix<NumericT, F> & A)
00062     {
00063       return scalar_expression< const matrix_base<NumericT, F>, const matrix_base<NumericT, F>, op_norm_frobenius>(A, A);
00064     }
00065 
00066   } // end namespace linalg
00067 } // end namespace viennacl
00068 #endif
00069 
00070 
00071 
00072 
00073