source: Sophya/trunk/SophyaExt/Blitz/blitz/array/zip.h@ 3864

Last change on this file since 3864 was 221, checked in by ansari, 26 years ago

Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99

File size: 1.2 KB
Line 
1#ifndef BZ_ARRAYZIP_H
2#define BZ_ARRAYZIP_H
3
4#ifndef BZ_ARRAY_H
5 #error <blitz/array/zip.h> must be included via <blitz/array.h>
6#endif
7
8BZ_NAMESPACE(blitz)
9
10template<class P_component, class T1, class T2>
11struct Zip2 {
12 typedef P_component T_numtype;
13
14 static inline T_numtype apply(T1 a, T2 b)
15 { return T_numtype(a,b); }
16
17 template<class T_left, class T_right>
18 static inline void prettyPrint(string& str,
19 prettyPrintFormat& format, const T_left& t1,
20 const T_right& t2)
21 {
22 str += "zip(";
23 t1.prettyPrint(str, format);
24 str += ",";
25 t2.prettyPrint(str, format);
26 str += ")";
27 }
28};
29
30template<class T_component, class T1, class T2>
31inline _bz_ArrayExpr<_bz_ArrayExprOp<_bz_typename asExpr<T1>::T_expr,
32 _bz_typename asExpr<T2>::T_expr, Zip2<T_component,
33 _bz_typename asExpr<T1>::T_expr::T_numtype,
34 _bz_typename asExpr<T2>::T_expr::T_numtype> > >
35zip(const T1& a, const T2& b, T_component)
36{
37 return _bz_ArrayExpr<_bz_ArrayExprOp<_bz_typename asExpr<T1>::T_expr,
38 _bz_typename asExpr<T2>::T_expr, Zip2<T_component,
39 _bz_typename asExpr<T1>::T_expr::T_numtype,
40 _bz_typename asExpr<T2>::T_expr::T_numtype> > >(a,b);
41}
42
43BZ_NAMESPACE_END
44
45#endif // BZ_ARRAYZIP_H
46
Note: See TracBrowser for help on using the repository browser.