00001
00002
00003
00004
00012 #ifndef __LIST_SKELETONS_H__
00013 #define __LIST_SKELETONS_H__
00014
00015 #include <iostream>
00016 #include <utility>
00017 #include "dist_list.h"
00018
00022 class list_skeletons
00023 {
00024
00025
00026
00036 public:
00037 template< typename F, typename A >
00038 static dist_list< typename F::result_type > *
00039 map( const F &f,
00040 const dist_list< A > *as );
00041
00058 public:
00059 template< typename F, typename A >
00060 static void map( const F &f,
00061 const dist_list< A > *as,
00062 dist_list< typename F::first_argument_type > *bs );
00073 public:
00074 template< typename F, typename A >
00075 static void map_ow( const F &f,
00076 dist_list< A > *as);
00077
00078
00079
00080
00090 public:
00091 template< typename F, typename A >
00092 static dist_list< typename F::result_type > *
00093 mapindex( const F &f,
00094 const dist_list< A > *as );
00095
00112 public:
00113 template< typename F, typename A >
00114 static void mapindex( const F &f,
00115 const dist_list< A > *as,
00116 dist_list< typename F::first_argument_type > *bs );
00117
00130 public:
00131 template< typename F, typename A >
00132 static void mapindex_ow( const F &f,
00133 dist_list< A > *as);
00134
00135
00136
00137
00147 public:
00148 template< typename OPLUS, typename A >
00149 static A reduce( const OPLUS &oplus,
00150 const A &e,
00151 const dist_list< A > *as );
00152
00164 public:
00165 template< typename OPLUS, typename A >
00166 static void reduce( const OPLUS &oplus,
00167 const A *e,
00168 const dist_list< A > *as,
00169 A *retval );
00170
00171
00172
00173
00184 public:
00185 template< typename A, typename OPLUS >
00186 static dist_list< A > *scan( const OPLUS &oplus,
00187 const A &e,
00188 const dist_list< A > *as );
00189
00190
00205 public:
00206 template< typename OPLUS, typename A >
00207 static void scan( const OPLUS &oplus,
00208 const A *e,
00209 const dist_list< A > *as,
00210 dist_list< A > *bs );
00211
00222 public:
00223 template< typename A, typename OPLUS >
00224 static dist_list< A > *scanr( const OPLUS &oplus,
00225 const A &e,
00226 const dist_list< A > *as );
00227
00242 public:
00243 template< typename OPLUS, typename A >
00244 static void scanr( const OPLUS &oplus,
00245 const A *e,
00246 const dist_list< A > *as,
00247 dist_list< A > *bs );
00248
00249
00250
00251
00262 public:
00263 template< typename A, typename OPLUS >
00264 static dist_list< A > *
00265 prescan( const OPLUS &oplus,
00266 const A &e,
00267 const dist_list< A > *as );
00268
00283 public:
00284 template< typename OPLUS, typename A >
00285 static void
00286 prescan( const OPLUS &oplus,
00287 const A *e,
00288 const dist_list< A > *as,
00289 dist_list< A > *bs );
00290
00301 public:
00302 template< typename A, typename OPLUS >
00303 static void
00304 prescan_ow( const OPLUS &oplus,
00305 const A &e,
00306 dist_list< A > *as );
00317 public:
00318 template< typename A, typename OPLUS >
00319 static dist_list< A > *
00320 prescanr( const OPLUS &oplus,
00321 const A &e,
00322 const dist_list< A > *as );
00323
00338 public:
00339 template< typename OPLUS, typename A >
00340 static void
00341 prescanr( const OPLUS &oplus,
00342 const A *e,
00343 const dist_list< A > *as,
00344 dist_list< A > *bs );
00345
00356 public:
00357 template< typename A, typename OPLUS >
00358 static void
00359 prescanr_ow( const OPLUS &oplus,
00360 const A &e,
00361 dist_list< A > *as );
00362
00363
00364
00365
00375 public:
00376 template< typename A, typename B >
00377 static dist_list< std::pair< A, B > > *
00378 zip( const dist_list< A > *as,
00379 const dist_list< B > *bs );
00390 public:
00391 template< typename A, typename B >
00392 static void
00393 zip( const dist_list< A > *as,
00394 const dist_list< B > *bs,
00395 dist_list< std::pair< A, B > > *cs );
00396
00397
00398
00399
00410 public:
00411 template< typename F, typename A, typename B >
00412 static dist_list< typename F::result_type > *
00413 zipwith( const F &f,
00414 const dist_list< A > *as,
00415 const dist_list< B > *bs );
00416
00436 public:
00437 template< typename F, typename A, typename B >
00438 static void zipwith( const F &f,
00439 const dist_list< A > *as,
00440 const dist_list< B > *bs,
00441 dist_list< typename F::first_argument_type > *cs );
00442
00443
00444
00445
00460 public:
00461 template< typename F, typename A, typename B >
00462 static dist_list< typename F::result_type > *
00463 zipwithindex( const F &f,
00464 const dist_list< A > *as,
00465 const dist_list< B > *bs );
00466
00487 public:
00488 template< typename F, typename A, typename B >
00489 static void zipwithindex( const F &f,
00490 const dist_list< A > *as,
00491 const dist_list< B > *bs,
00492 dist_list< typename F::first_argument_type > *cs );
00493
00494
00495
00496
00503 public:
00504 template< typename A >
00505 static dist_list< A > *shiftr( const A& firstval,
00506 const dist_list< A > *as );
00507
00515 public:
00516 template< typename A >
00517 static void shiftr_ow( const A& firstval,
00518 dist_list< A > *as);
00519
00526 public:
00527 template< typename A >
00528 static dist_list< A > *shiftl( const A& lastval,
00529 const dist_list< A > *as);
00530
00538 public:
00539 template< typename A >
00540 static void shiftl_ow( const A& lastval,
00541 dist_list< A > *as );
00542
00543
00544
00545
00559 public:
00560 template< typename G, typename P, typename OPLUS, typename Q, typename OTIMES, typename A >
00561 static typename P::result_type
00562 accumulate( const G &g,
00563 const P &p,
00564 const OPLUS &oplus,
00565 const Q &q,
00566 const OTIMES &otimes,
00567 const typename G::argument_type &e,
00568 const dist_list< A > *as );
00569
00586 public:
00587 template< typename G, typename P, typename OPLUS, typename Q, typename OTIMES, typename A >
00588 static void accumulate( const G &g,
00589 const P &p,
00590 const OPLUS &oplus,
00591 const Q &q,
00592 const OTIMES &otimes,
00593 const typename G::second_argument_type *e,
00594 const dist_list< A > *as,
00595 typename P::first_argument_type *retval );
00596
00597
00598
00599
00606 public:
00607 template< typename A >
00608 static void
00609 gather( const dist_list< A > *as, A *array );
00610
00611
00612
00613
00624 template< typename A >
00625 static void print( const dist_list< A > *as,
00626 std::ostream &stream = std::cout );
00627
00640 template< typename A >
00641 static void print( const dist_list< A > *as,
00642 int index,
00643 std::ostream &stream = std::cout );
00644
00645
00646
00647
00648 public:
00649 template< typename OPLUS, typename P, typename A >
00650 static typename P::result_type
00651 cataj( const OPLUS &oplus,
00652 const P &p,
00653 const typename P::result_type &e,
00654 const dist_list< A > *as );
00655
00656 public:
00657 template< typename OPLUS, typename P, typename A >
00658 static void
00659 cataj( const OPLUS &oplus,
00660 const P &p,
00661 const typename P::first_argument_type *e,
00662 const dist_list< A > *as,
00663 typename P::first_argument_type *retval );
00664
00665 public:
00666 template< typename OPLUS, typename A, typename B >
00667 static std::pair< A, B >
00668 zip_reduce( const OPLUS &oplus,
00669 const std::pair< A, B > &e,
00670 const dist_list< A > *as,
00671 const dist_list< B > *bs );
00672
00673 public:
00674 template< typename OPLUS, typename A, typename B >
00675 static void
00676 zip_reduce( const OPLUS &oplus,
00677 const std::pair< A, B > *e,
00678 const dist_list< A > *as,
00679 const dist_list< B > *bs,
00680 std::pair< A, B > *result );
00681
00682 public:
00683 template< typename F, typename OPLUS, typename A, typename B >
00684 static typename F::result_type
00685 zipwith_reduce( const F &f,
00686 const OPLUS &oplus,
00687 const typename F::result_type &e,
00688 const dist_list< A > *as,
00689 const dist_list< B > *bs );
00690 public:
00691 template< typename F, typename OPLUS, typename A, typename B >
00692 static void
00693 zipwith_reduce( const F &f,
00694 const OPLUS &oplus,
00695 const typename F::result_type *e,
00696 const dist_list< A > *as,
00697 const dist_list< B > *bs,
00698 typename F::result_type *result );
00699
00700 };
00701
00702 #include "list_skeletons.tpp"
00703 #endif // __LIST_SKELETONS_H__