Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShLibArith.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory
00004 // Project administrator: Michael D. McCool
00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa,
00006 //          Michael D. McCool
00007 // 
00008 // This software is provided 'as-is', without any express or implied
00009 // warranty. In no event will the authors be held liable for any damages
00010 // arising from the use of this software.
00011 // 
00012 // Permission is granted to anyone to use this software for any purpose,
00013 // including commercial applications, and to alter it and redistribute it
00014 // freely, subject to the following restrictions:
00015 // 
00016 // 1. The origin of this software must not be misrepresented; you must
00017 // not claim that you wrote the original software. If you use this
00018 // software in a product, an acknowledgment in the product documentation
00019 // would be appreciated but is not required.
00020 // 
00021 // 2. Altered source versions must be plainly marked as such, and must
00022 // not be misrepresented as being the original software.
00023 // 
00024 // 3. This notice may not be removed or altered from any source
00025 // distribution.
00027 #ifndef SHLIBARITH_HPP
00028 #define SHLIBARITH_HPP
00029 
00030 #include "ShGeneric.hpp"
00031 #include "ShLib.hpp"
00032 
00033 #ifndef WIN32
00034 namespace SH {
00035 
00045 template<int N, typename T1, typename T2>
00046 ShGeneric<N, CT1T2> operator+(const ShGeneric<N, T1>& left, const ShGeneric<N, T2>& right);
00047 template<int N, typename T1, typename T2>
00048 ShGeneric<N, CT1T2> operator+(const ShGeneric<1, T1>& left, const ShGeneric<N, T2>& right);
00049 template<int N, typename T1, typename T2>
00050 ShGeneric<N, CT1T2> operator+(const ShGeneric<N, T1>& left, const ShGeneric<1, T2>& right);
00051 template<typename T1, typename T2>
00052 ShGeneric<1, CT1T2> operator+(const ShGeneric<1, T1>& left, const ShGeneric<1, T2>& right);
00053 SH_SHLIB_CONST_SCALAR_OP_DECL(operator+);
00054 SH_SHLIB_CONST_N_OP_BOTH_DECL(operator+);
00055 
00060 template<int N, typename T1, typename T2>
00061 ShGeneric<N, CT1T2> operator-(const ShGeneric<N, T1>& left, const ShGeneric<N, T2>& right);
00062 template<int N, typename T1, typename T2>
00063 ShGeneric<N, CT1T2> operator-(const ShGeneric<1, T1>& left, const ShGeneric<N, T2>& right);
00064 template<int N, typename T1, typename T2>
00065 ShGeneric<N, CT1T2> operator-(const ShGeneric<N, T1>& left, const ShGeneric<1, T2>& right);
00066 template<typename T1, typename T2>
00067 ShGeneric<1, CT1T2> operator-(const ShGeneric<1, T1>& left, const ShGeneric<1, T2>& right);
00068 SH_SHLIB_CONST_SCALAR_OP_DECL(operator-);
00069 SH_SHLIB_CONST_N_OP_BOTH_DECL(operator-);
00070 
00076 template<int N, typename T1, typename T2>
00077 ShGeneric<N, CT1T2> operator*(const ShGeneric<N, T1>& left, const ShGeneric<N, T2>& right);
00078 template<int N, typename T1, typename T2>
00079 ShGeneric<N, CT1T2> operator*(const ShGeneric<1, T1>& left, const ShGeneric<N, T2>& right);
00080 template<int N, typename T1, typename T2>
00081 ShGeneric<N, CT1T2> operator*(const ShGeneric<N, T1>& left, const ShGeneric<1, T2>& right);
00082 template<typename T1, typename T2>
00083 ShGeneric<1, CT1T2> operator*(const ShGeneric<1, T1>& left, const ShGeneric<1, T2>& right);
00084 SH_SHLIB_CONST_SCALAR_OP_DECL(operator*);
00085 SH_SHLIB_CONST_N_OP_BOTH_DECL(operator*);
00086 
00092 template<int N, typename T1, typename T2>
00093 ShGeneric<N, CT1T2> operator/(const ShGeneric<N, T1>& left, const ShGeneric<N, T2>& right);
00094 template<int N, typename T1, typename T2>
00095 ShGeneric<N, CT1T2> operator/(const ShGeneric<N, T1>& left, const ShGeneric<1, T2>& right);
00096 template<int N, typename T1, typename T2>
00097 ShGeneric<N, CT1T2> operator/(const ShGeneric<1, T1>& left, const ShGeneric<N, T2>& right);
00098 template<typename T1, typename T2>
00099 ShGeneric<1, CT1T2> operator/(const ShGeneric<1, T1>& left, const ShGeneric<1, T2>& right);
00100 SH_SHLIB_CONST_SCALAR_OP_DECL(operator/);
00101 SH_SHLIB_CONST_N_OP_LEFT_DECL(operator/);
00102 
00103 
00108 template<int N, typename T>
00109 ShGeneric<N, T> exp(const ShGeneric<N, T>& var);
00110 
00115 template<int N, typename T>
00116 ShGeneric<N, T> exp2(const ShGeneric<N, T>& var);
00117 
00122 template<int N, typename T>
00123 ShGeneric<N, T> exp(const ShGeneric<N, T>& var);
00124 
00129 template<int N, typename T>
00130 ShGeneric<N, T> expm1(const ShGeneric<N, T>& x);
00131 
00136 template<int N, typename T>
00137 ShGeneric<N, T> log(const ShGeneric<N, T>& var);
00138 
00143 template<int N, typename T>
00144 ShGeneric<N, T> log2(const ShGeneric<N, T>& var);
00145 
00150 template<int N, typename T>
00151 ShGeneric<N, T> log(const ShGeneric<N, T>& var);
00152 
00157 template<int N, typename T>
00158 ShGeneric<N, T> logp1(const ShGeneric<N, T>& x);
00159 
00164 template<int N, typename T1, typename T2, typename T3>
00165 ShGeneric<N, CT1T2>
00166 pow(const ShGeneric<N, T1>& left, const ShGeneric<N, T2>& right);
00167 template<int N, typename T1, typename T2, typename T3>
00168 ShGeneric<N, CT1T2>
00169 pow(const ShGeneric<N, T1>& left, const ShGeneric<1, T2>& right);
00170 template<typename T1, typename T2, typename T3>
00171 ShGeneric<1, CT1T2> pow(const ShGeneric<1, T1>& left, const ShGeneric<1, T2>& right);
00172 
00173 SH_SHLIB_CONST_SCALAR_OP_DECL(pow);
00174 SH_SHLIB_CONST_N_OP_RIGHT_DECL(pow);
00175 
00181 template<int N, typename T1, typename T2, typename T3>
00182 ShGeneric<N, CT1T2T3>
00183 mad(const ShGeneric<N, T1>& m1, const ShGeneric<N, T2>& m2, 
00184                     const ShGeneric<N, T3>& a);
00185 template<int N, typename T1, typename T2, typename T3>
00186 ShGeneric<N, CT1T2T3>
00187 mad(const ShGeneric<N, T1>& m1, const ShGeneric<1, T2>& m2, 
00188                     const ShGeneric<N, T3>& a);
00189 template<int N, typename T1, typename T2, typename T3>
00190 ShGeneric<N, CT1T2T3>
00191 mad(const ShGeneric<1, T1>& m1, const ShGeneric<N, T2>& m2, 
00192                     const ShGeneric<N, T3>& a);
00193 template<typename T1, typename T2, typename T3>
00194 ShGeneric<1, CT1T2T3> mad(const ShGeneric<1, T1>& m1, const ShGeneric<1, T2>& m2, 
00195                     const ShGeneric<1, T3>& a);
00196 
00197 //@todo type should not use double here, but overloading problems need to be
00198 //resolved
00199 //template<int N, typename T> 
00200 //ShGeneric<N, T> 
00201 //mad(T m1, const ShGeneric<N, T>& m2, const ShGeneric<N, T>& a);
00202 //template<int N, typename T> 
00203 //ShGeneric<N, T>
00204 //mad(const ShGeneric<N, T>& m1, T m2, const ShGeneric<N, T>& a);
00205 
00206 //@todo type not sure these are a good idea
00207 template<int N, typename T1, typename T2> 
00208 ShGeneric<N, CT1T2> 
00209 mad(double m1, const ShGeneric<N, T1>& m2, const ShGeneric<N, T2>& a);
00210 template<int N, typename T1, typename T2> 
00211 ShGeneric<N, CT1T2>
00212 mad(const ShGeneric<N, T1>& m1, double m2, const ShGeneric<N, T2>& a);
00213 
00214 /* Reciprocal
00215  * One divided by the given value, for each component.
00216  */
00217 template<int N, typename T>
00218 ShGeneric<N, T> rcp(const ShGeneric<N, T>& var);
00219 
00220 /* Square root.
00221  * The square root of each component of the input is evaluated.
00222  */
00223 template<int N, typename T>
00224 ShGeneric<N, T> sqrt(const ShGeneric<N, T>& var);
00225 
00226 /* Reciprocal square root.
00227  * The inverse of the square root of each component of the input is evaluated.
00228  */
00229 template<int N, typename T>
00230 ShGeneric<N, T> rsqrt(const ShGeneric<N, T>& var);
00231 
00232 /* Cube root.
00233  * The cube root of each component of the input is evaluated.
00234  */
00235 template<int N, typename T>
00236 ShGeneric<N, T> cbrt(const ShGeneric<N, T>& var);
00237 
00244 template<int N, typename T1, typename T2, typename T3>
00245 ShGeneric<N, CT1T2T3>
00246 lerp(const ShGeneric<N, T1>& f, const ShGeneric<N, T2>& a, 
00247                      const ShGeneric<N, T3>& b);
00248 template<int N, typename T1, typename T2, typename T3>
00249 ShGeneric<N, CT1T2T3>
00250 lerp(const ShGeneric<1, T1>& f, const ShGeneric<N, T2>& a, 
00251                      const ShGeneric<N, T3>& b);
00252 template<typename T1, typename T2, typename T3>
00253 ShGeneric<1, CT1T2T3> 
00254 lerp(const ShGeneric<1, T1>& f, const ShGeneric<1, T2>& a, 
00255      const ShGeneric<1, T3>& b);
00256 
00257 template<int N, typename T1, typename T2>
00258 ShGeneric<N, CT1T2>
00259 lerp(double f, const ShGeneric<N, T1>& a, const ShGeneric<N, T2>& b);
00260 
00261 
00262 /* Sum of components.
00263  * Addition of all components into a single result.
00264  */
00265 template<int N, typename T>
00266 ShGeneric<1, T> sum(const ShGeneric<N, T>& var);
00267 
00268 /* Product of components.
00269  * Multiplication of all components into a single result.
00270  */
00271 template<int N, typename T>
00272 ShGeneric<1, T> prod(const ShGeneric<N, T>& var);
00273 
00274 }
00275 #endif
00276 
00277 #include "ShLibArithImpl.hpp"
00278 
00279 #endif

Generated on Mon Jan 24 18:36:32 2005 for Sh by  doxygen 1.4.1