@@ -571,6 +571,166 @@ 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 >(
609+ internal::getRefMatrix ( A ),
610+ internal::getRefMatrix ( mask ),
611+ internal::getRefMatrix ( B ),
612+ monoid
613+ );
614+ }
615+
616+ template <
617+ Descriptor descr = descriptors::no_operation,
618+ class Monoid ,
619+ typename IOType, typename InputType,
620+ typename RIT_A, typename CIT_A, typename NIT_A,
621+ typename RIT_B, typename CIT_B, typename NIT_B
622+ >
623+ RC foldl (
624+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
625+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
626+ const Monoid &monoid = Monoid(),
627+ const typename std::enable_if<
628+ !grb::is_object< IOType >::value &&
629+ !grb::is_object< InputType >::value &&
630+ grb::is_monoid< Monoid >::value, void
631+ >::type * const = nullptr
632+ ) {
633+ if ( internal::NONBLOCKING::warn_if_not_native &&
634+ config::PIPELINE::warn_if_not_native
635+ ) {
636+ std::cerr << " Warning: foldl( nonblocking ) currently delegates to a "
637+ << " blocking implementation.\n "
638+ << " Further similar such warnings will be suppressed.\n " ;
639+ internal::NONBLOCKING::warn_if_not_native = false ;
640+ }
641+
642+ // nonblocking execution is not supported
643+ // first, execute any computation that is not completed
644+ internal::le.execution ();
645+
646+ // second, delegate to the reference backend
647+ return foldl< descr, Monoid >(
648+ internal::getRefMatrix ( A ),
649+ internal::getRefMatrix ( B ),
650+ monoid
651+ );
652+ }
653+
654+ template <
655+ Descriptor descr = descriptors::no_operation,
656+ class Monoid ,
657+ typename IOType, typename MaskType, typename InputType,
658+ typename RIT_A, typename CIT_A, typename NIT_A,
659+ typename RIT_M, typename CIT_M, typename NIT_M,
660+ typename RIT_B, typename CIT_B, typename NIT_B
661+ >
662+ RC foldr (
663+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
664+ const Matrix< MaskType, nonblocking, RIT_M, CIT_M, NIT_M > &mask,
665+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
666+ const Monoid &monoid = Monoid(),
667+ const typename std::enable_if<
668+ !grb::is_object< IOType >::value &&
669+ !grb::is_object< InputType >::value &&
670+ !grb::is_object< MaskType >::value &&
671+ grb::is_monoid< Monoid >::value, void
672+ >::type * const = nullptr
673+ ) {
674+ if ( internal::NONBLOCKING::warn_if_not_native &&
675+ config::PIPELINE::warn_if_not_native
676+ ) {
677+ std::cerr << " Warning: foldr( nonblocking ) currently delegates to a "
678+ << " blocking implementation.\n "
679+ << " Further similar such warnings will be suppressed.\n " ;
680+ internal::NONBLOCKING::warn_if_not_native = false ;
681+ }
682+
683+ // nonblocking execution is not supported
684+ // first, execute any computation that is not completed
685+ internal::le.execution ();
686+
687+ // second, delegate to the reference backend
688+ return foldr< descr, Monoid >(
689+ internal::getRefMatrix ( A ),
690+ internal::getRefMatrix ( mask ),
691+ internal::getRefMatrix ( B ),
692+ monoid
693+ );
694+ }
695+
696+ template <
697+ Descriptor descr = descriptors::no_operation,
698+ class Monoid ,
699+ typename IOType, typename InputType,
700+ typename RIT_A, typename CIT_A, typename NIT_A,
701+ typename RIT_B, typename CIT_B, typename NIT_B
702+ >
703+ RC foldr (
704+ Matrix< IOType, nonblocking, RIT_A, CIT_A, NIT_A > &A,
705+ const Matrix< InputType, nonblocking, RIT_B, CIT_B, NIT_B > &B,
706+ const Monoid &monoid = Monoid(),
707+ const typename std::enable_if<
708+ !grb::is_object< IOType >::value &&
709+ !grb::is_object< InputType >::value &&
710+ grb::is_monoid< Monoid >::value, void
711+ >::type * const = nullptr
712+ ) {
713+ if ( internal::NONBLOCKING::warn_if_not_native &&
714+ config::PIPELINE::warn_if_not_native
715+ ) {
716+ std::cerr << " Warning: foldr( nonblocking ) currently delegates to a "
717+ << " blocking implementation.\n "
718+ << " Further similar such warnings will be suppressed.\n " ;
719+ internal::NONBLOCKING::warn_if_not_native = false ;
720+ }
721+
722+ // nonblocking execution is not supported
723+ // first, execute any computation that is not completed
724+ internal::le.execution ();
725+
726+ // second, delegate to the reference backend
727+ return foldr< descr, Monoid >(
728+ internal::getRefMatrix ( A ),
729+ internal::getRefMatrix ( B ),
730+ monoid
731+ );
732+ }
733+
574734} // namespace grb
575735
576736#undef NO_CAST_ASSERT
0 commit comments