tvecglobs.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  * blitz/tvecglobs.h     TinyVector global functions
00003  *
00004  * $Id: tvecglobs.h,v 1.3 2003/12/11 03:44:22 julianc Exp $
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * Suggestions:          blitz-dev@oonumerics.org
00017  * Bugs:                 blitz-bugs@oonumerics.org
00018  *
00019  * For more information, please see the Blitz++ Home Page:
00020  *    http://oonumerics.org/blitz/
00021  *
00022  ***************************************************************************/
00023 
00024 #ifndef BZ_TVECGLOBS_H
00025 #define BZ_TVECGLOBS_H
00026 
00027 #ifndef BZ_META_METAPROG_H
00028  #include <blitz/meta/metaprog.h>
00029 #endif
00030 
00031 #ifndef BZ_NUMTRAIT_H
00032  #include <blitz/numtrait.h>
00033 #endif
00034 
00035 #include <blitz/tvcross.h>       // Cross products
00036 #include <blitz/meta/dot.h>
00037 #include <blitz/meta/product.h>
00038 #include <blitz/meta/sum.h>
00039 
00040 BZ_NAMESPACE(blitz)
00041 
00042 template<typename T_numtype1, typename T_numtype2, int N_length>
00043 inline BZ_PROMOTE(T_numtype1, T_numtype2)
00044 dot(const TinyVector<T_numtype1, N_length>& a, 
00045     const TinyVector<T_numtype2, N_length>& b)
00046 {
00047     return _bz_meta_vectorDot<N_length, 0>::f(a,b);
00048 }
00049 
00050 template<typename T_expr1, typename T_numtype2, int N_length>
00051 inline BZ_PROMOTE(_bz_typename T_expr1::T_numtype, T_numtype2)
00052 dot(_bz_VecExpr<T_expr1> a, const TinyVector<T_numtype2, N_length>& b)
00053 {
00054     return _bz_meta_vectorDot<N_length, 0>::f_value_ref(a,b);
00055 }
00056 
00057 template<typename T_numtype1, typename T_expr2, int N_length>
00058 inline BZ_PROMOTE(T_numtype1, _bz_typename T_expr2::T_numtype)
00059 dot(const TinyVector<T_numtype1, N_length>& a, _bz_VecExpr<T_expr2> b)
00060 {
00061     return _bz_meta_vectorDot<N_length, 0>::f_ref_value(a,b);
00062 }
00063 
00064 template<typename T_numtype1, int N_length>
00065 inline BZ_SUMTYPE(T_numtype1)
00066 product(const TinyVector<T_numtype1, N_length>& a)
00067 {
00068     return _bz_meta_vectorProduct<N_length, 0>::f(a);
00069 }
00070 
00071 template<typename T_numtype, int N_length>
00072 inline T_numtype
00073 sum(const TinyVector<T_numtype, N_length>& a)
00074 {
00075     return _bz_meta_vectorSum<N_length, 0>::f(a);
00076 }
00077 
00078 BZ_NAMESPACE_END
00079 
00080 #endif // BZ_TVECGLOBS_H
00081 

Generated on Mon Oct 22 10:03:50 2007 for blitz by  doxygen 1.3.9.1