56 template<
typename dtype>
59 return mean(inArray, inAxis);
74 template<
typename dtype>
90 weightedArray.
begin(), std::multiplies<double>());
92 double sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), 0.0);
100 if (inWeights.
size() != arrayShape.
cols)
105 double weightSum = inWeights.template astype<double>().
sum().
item();
107 for (
uint32 row = 0; row < arrayShape.
rows; ++row)
111 weightedArray.
begin(), std::multiplies<double>());
113 double sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), 0.0);
114 returnArray(0, row) =
sum / weightSum;
128 const Shape transShape = transposedArray.
shape();
129 double weightSum = inWeights.template astype<double>().
sum().
item();
131 for (
uint32 row = 0; row < transShape.
rows; ++row)
135 weightedArray.
begin(), std::multiplies<double>());
137 double sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), 0.0);
138 returnArray(0, row) =
sum / weightSum;
163 template<
typename dtype>
169 const auto multiplies = [](
const std::complex<dtype>& lhs, dtype rhs) -> std::complex<double>
171 return complex_cast<double>(lhs) *
static_cast<double>(rhs);
178 if (inWeights.
shape() != inArray.shape())
185 weightedArray.
begin(), multiplies);
187 std::complex<double>
sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), std::complex<double>(0.0));
194 const Shape arrayShape = inArray.shape();
195 if (inWeights.
size() != arrayShape.
cols)
200 double weightSum = inWeights.template astype<double>().
sum().
item();
202 for (
uint32 row = 0; row < arrayShape.
rows; ++row)
206 weightedArray.
begin(), multiplies);
208 const std::complex<double>
sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(),
209 std::complex<double>(0.0));
210 returnArray(0, row) =
sum / weightSum;
217 if (inWeights.
size() != inArray.shape().rows)
224 const Shape transShape = transposedArray.
shape();
225 double weightSum = inWeights.template astype<double>().
sum().
item();
227 for (
uint32 row = 0; row < transShape.
rows; ++row)
231 weightedArray.
begin(), multiplies);
233 const std::complex<double>
sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(),
234 std::complex<double>(0.0));
235 returnArray(0, row) =
sum / weightSum;