@@ -571,6 +571,148 @@ namespace grb {
571571 );
572572 }
573573
574+ template <
575+ Descriptor descr = descriptors::no_operation,
576+ class Monoid ,
577+ typename IOType, typename MaskType, typename InputType,
578+ typename RIT_A, typename CIT_A, typename NIT_A,
579+ typename RIT_M, typename CIT_M, typename NIT_M,
580+ typename RIT_B, typename CIT_B, typename NIT_B
581+ >
582+ RC foldl (
583+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
584+ const Matrix< MaskType, nonblocking, RIT_M, CIT_M, NIT_M > &mask,
585+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
586+ const Monoid &monoid = Monoid(),
587+ const typename std::enable_if<
588+ !grb::is_object< IOType >::value &&
589+ !grb::is_object< InputType >::value &&
590+ !grb::is_object< MaskType >::value &&
591+ grb::is_monoid< Monoid >::value, void
592+ >::type * const = nullptr
593+ ) {
594+ if ( internal::NONBLOCKING::warn_if_not_native &&
595+ config::PIPELINE::warn_if_not_native
596+ ) {
597+ std::cerr << " Warning: foldl( nonblocking ) currently delegates to a "
598+ << " blocking implementation.\n "
599+ << " Further similar such warnings will be suppressed.\n " ;
600+ internal::NONBLOCKING::warn_if_not_native = false ;
601+ }
602+
603+ // nonblocking execution is not supported
604+ // first, execute any computation that is not completed
605+ internal::le.execution ();
606+
607+ // second, delegate to the reference backend
608+ return foldl< descr, Monoid >( getRefMatrix ( A ), getRefMatrix ( mask ), getRefMatrix ( B ), monoid );
609+ }
610+
611+ template <
612+ Descriptor descr = descriptors::no_operation,
613+ class Monoid ,
614+ typename IOType, typename InputType,
615+ typename RIT_A, typename CIT_A, typename NIT_A,
616+ typename RIT_B, typename CIT_B, typename NIT_B
617+ >
618+ RC foldl (
619+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
620+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
621+ const Monoid &monoid = Monoid(),
622+ const typename std::enable_if<
623+ !grb::is_object< IOType >::value &&
624+ !grb::is_object< InputType >::value &&
625+ grb::is_monoid< Monoid >::value, void
626+ >::type * const = nullptr
627+ ) {
628+ if ( internal::NONBLOCKING::warn_if_not_native &&
629+ config::PIPELINE::warn_if_not_native
630+ ) {
631+ std::cerr << " Warning: foldl( nonblocking ) currently delegates to a "
632+ << " blocking implementation.\n "
633+ << " Further similar such warnings will be suppressed.\n " ;
634+ internal::NONBLOCKING::warn_if_not_native = false ;
635+ }
636+
637+ // nonblocking execution is not supported
638+ // first, execute any computation that is not completed
639+ internal::le.execution ();
640+
641+ // second, delegate to the reference backend
642+ return foldl< descr, Monoid >( getRefMatrix ( A ), getRefMatrix ( B ), monoid );
643+ }
644+
645+ template <
646+ Descriptor descr = descriptors::no_operation,
647+ class Monoid ,
648+ typename IOType, typename MaskType, typename InputType,
649+ typename RIT_A, typename CIT_A, typename NIT_A,
650+ typename RIT_M, typename CIT_M, typename NIT_M,
651+ typename RIT_B, typename CIT_B, typename NIT_B
652+ >
653+ RC foldr (
654+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
655+ const Matrix< MaskType, nonblocking, RIT_M, CIT_M, NIT_M > &mask,
656+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
657+ const Monoid &monoid = Monoid(),
658+ const typename std::enable_if<
659+ !grb::is_object< IOType >::value &&
660+ !grb::is_object< InputType >::value &&
661+ !grb::is_object< MaskType >::value &&
662+ grb::is_monoid< Monoid >::value, void
663+ >::type * const = nullptr
664+ ) {
665+ if ( internal::NONBLOCKING::warn_if_not_native &&
666+ config::PIPELINE::warn_if_not_native
667+ ) {
668+ std::cerr << " Warning: foldr( nonblocking ) currently delegates to a "
669+ << " blocking implementation.\n "
670+ << " Further similar such warnings will be suppressed.\n " ;
671+ internal::NONBLOCKING::warn_if_not_native = false ;
672+ }
673+
674+ // nonblocking execution is not supported
675+ // first, execute any computation that is not completed
676+ internal::le.execution ();
677+
678+ // second, delegate to the reference backend
679+ return foldr< descr, Monoid >( getRefMatrix ( A ), getRefMatrix ( mask ), getRefMatrix ( B ), monoid );
680+ }
681+
682+ template <
683+ Descriptor descr = descriptors::no_operation,
684+ class Monoid ,
685+ typename IOType, typename InputType,
686+ typename RIT_A, typename CIT_A, typename NIT_A,
687+ typename RIT_B, typename CIT_B, typename NIT_B
688+ >
689+ RC foldr (
690+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
691+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
692+ const Monoid &monoid = Monoid(),
693+ const typename std::enable_if<
694+ !grb::is_object< IOType >::value &&
695+ !grb::is_object< InputType >::value &&
696+ grb::is_monoid< Monoid >::value, void
697+ >::type * const = nullptr
698+ ) {
699+ if ( internal::NONBLOCKING::warn_if_not_native &&
700+ config::PIPELINE::warn_if_not_native
701+ ) {
702+ std::cerr << " Warning: foldr( nonblocking ) currently delegates to a "
703+ << " blocking implementation.\n "
704+ << " Further similar such warnings will be suppressed.\n " ;
705+ internal::NONBLOCKING::warn_if_not_native = false ;
706+ }
707+
708+ // nonblocking execution is not supported
709+ // first, execute any computation that is not completed
710+ internal::le.execution ();
711+
712+ // second, delegate to the reference backend
713+ return foldr< descr, Monoid >( getRefMatrix ( A ), getRefMatrix ( B ), monoid );
714+ }
715+
574716} // namespace grb
575717
576718#undef NO_CAST_ASSERT
0 commit comments