39 #ifndef BZ_NUMINQUIRE_H
40 #include <blitz/numinquire.h>
45 template<typename P_sourcetype, typename P_resulttype =
BZ_SUMTYPE(P_sourcetype)>
53 static const bool needIndex =
false, canProvideInitialValue =
true;
58 ReduceSum(T_resulttype initialValue)
59 { sum_ = initialValue; }
61 bool operator()(T_sourcetype x)
67 bool operator()(T_sourcetype x,
int)
73 T_resulttype result(
int)
77 { sum_ = zero(T_resulttype()); }
79 void reset(T_resulttype initialValue)
80 { sum_ = initialValue; }
82 static const char* name()
89 template<
typename P_sourcetype,
typename P_resulttype = BZ_FLOATTYPE(P_sourcetype)>
104 BZPRECHECK(0,
"Provided an initial value for ReduceMean");
121 {
return sum_ / count; }
128 BZPRECHECK(0,
"Provided an initial value for ReduceMean");
139 template<
typename P_sourcetype>
175 {
min_ = huge(P_sourcetype()); }
178 {
min_ = initialValue; }
187 template<
typename P_sourcetype>
223 {
max_ = neghuge(P_sourcetype()); }
226 {
max_ = initialValue; }
235 template<
typename P_sourcetype>
280 BZPRECHECK(0,
"Provided initial value for ReduceMinIndex");
285 {
return "minIndex"; }
292 template<
typename P_sourcetype,
int N>
343 BZPRECHECK(0,
"Provided initial value for ReduceMinIndex");
348 {
return "minIndex"; }
355 template<
typename P_sourcetype>
400 BZPRECHECK(0,
"Provided initial value for ReduceMaxIndex");
405 {
return "maxIndex"; }
412 template<
typename P_sourcetype,
int N_rank>
457 BZPRECHECK(0,
"Provided initial value for ReduceMaxIndex");
462 {
return "maxIndex"; }
469 template<
typename P_sourcetype>
514 BZPRECHECK(0,
"Provided initial value for ReduceFirst");
525 template<
typename P_sourcetype>
570 BZPRECHECK(0,
"Provided initial value for ReduceFirst");
581 template<
typename P_sourcetype,
typename P_resulttype = BZ_SUMTYPE(P_sourcetype)>
619 {
return "product"; }
625 template<
typename P_sourcetype>
664 {
count_ = initialValue; }
673 template<
typename P_sourcetype>
721 BZPRECHECK(0,
"Provided initial value for ReduceAny");
732 template<
typename P_sourcetype>
780 BZPRECHECK(0,
"Provided initial value for ReduceAll");
793 #endif // BZ_REDUCE_H