• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List

/export/development/ViennaMath/viennamath/compiletime/binary_op_tags.hpp

Go to the documentation of this file.
00001 #ifndef VIENNAMATH_COMPILETIME_BINARY_OP_TAGS_HPP
00002 #define VIENNAMATH_COMPILETIME_BINARY_OP_TAGS_HPP
00003 
00004 /* =======================================================================
00005    Copyright (c) 2012, Institute for Microelectronics,
00006                        Institute for Analysis and Scientific Computing,
00007                        TU Wien.
00008                              -----------------
00009                ViennaMath - Symbolic and Numerical Math in C++
00010                              -----------------
00011 
00012    Author:     Karl Rupp                          rupp@iue.tuwien.ac.at
00013 
00014    License:    MIT (X11), see file LICENSE in the ViennaMath base directory
00015 ======================================================================= */
00016 
00017 
00018 
00019 
00020 #include <string>
00021 #include <vector>
00022 #include <math.h>
00023 #include "viennamath/forwards.h"
00024 
00029 namespace viennamath
00030 {
00031   
00032   //
00033   // addition
00034   //
00036   template <typename NumericT>
00037   struct op_plus
00038   {
00039     typedef NumericT        numeric_type;
00040     
00041     //template <typename LHS, typename RHS>
00042     //static typename op_return_type<LHS, RHS>::return_type apply(LHS const & lhs, RHS const & rhs) { return lhs + rhs; }
00043     
00044     static NumericT apply(NumericT lhs, NumericT rhs) { return lhs + rhs; }
00045     
00046     static std::string str() { return "+"; }
00047   };
00048   
00049   
00050   //
00051   // subtraction
00052   //
00054   template <typename NumericT>
00055   struct op_minus
00056   {
00057     typedef NumericT        numeric_type;
00058     
00059     //template <typename LHS, typename RHS>
00060     //static typename op_return_type<LHS, RHS>::return_type apply(LHS const & lhs, RHS const & rhs) { return lhs - rhs; }
00061     
00062     static NumericT apply(NumericT lhs, NumericT rhs) { return lhs - rhs; }
00063     
00064     static std::string str() { return "-"; }
00065   };
00066   
00067   
00068   //
00069   // multiplication
00070   //
00072   template <typename NumericT>
00073   struct op_mult
00074   {
00075     typedef NumericT        numeric_type;
00076     
00077     //template <typename LHS, typename RHS>
00078     //static typename op_return_type<LHS, RHS>::return_type apply(LHS const & lhs, RHS const & rhs) { return lhs * rhs; }
00079     
00080     static NumericT apply(NumericT lhs, NumericT rhs) { return lhs * rhs; }
00081     
00082     static std::string str() { return "*"; }
00083   };
00084   
00085   
00086   //
00087   // division
00088   //
00090   template <typename NumericT>
00091   struct op_div
00092   {
00093     typedef NumericT        numeric_type;
00094     
00095     //template <typename LHS, typename RHS>
00096     //static typename op_return_type<LHS, RHS>::return_type apply(LHS const & lhs, RHS const & rhs) { return lhs / rhs; }
00097     
00098     static NumericT apply(NumericT lhs, NumericT rhs) { return lhs / rhs; }
00099     
00100     static std::string str() { return "/"; }
00101   };
00102   
00103   
00104   
00105   
00106 }
00107 
00108 #endif

Generated on Wed Feb 29 2012 21:50:43 for ViennaMath by  doxygen 1.7.1