57 template<
typename dtype>
60 return mean(inArray, inAxis);
75 template<
typename dtype>
91 weightedArray.
begin(), std::multiplies<double>());
93 double sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), 0.0);
101 if (inWeights.
size() != arrayShape.
cols)
106 double weightSum = inWeights.template astype<double>().
sum().
item();
108 for (
uint32 row = 0; row < arrayShape.
rows; ++row)
112 weightedArray.
begin(), std::multiplies<double>());
114 double sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), 0.0);
115 returnArray(0, row) =
sum / weightSum;
129 const Shape transShape = transposedArray.
shape();
130 double weightSum = inWeights.template astype<double>().
sum().
item();
132 for (
uint32 row = 0; row < transShape.
rows; ++row)
136 weightedArray.
begin(), std::multiplies<double>());
138 double sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), 0.0);
139 returnArray(0, row) =
sum / weightSum;
164 template<
typename dtype>
170 const auto multiplies = [](
const std::complex<dtype>& lhs, dtype rhs) -> std::complex<double>
172 return complex_cast<double>(lhs) *
static_cast<double>(rhs);
179 if (inWeights.
shape() != inArray.shape())
186 weightedArray.
begin(), multiplies);
188 std::complex<double>
sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(), std::complex<double>(0.0));
195 const Shape arrayShape = inArray.shape();
196 if (inWeights.
size() != arrayShape.
cols)
201 double weightSum = inWeights.template astype<double>().
sum().
item();
203 for (
uint32 row = 0; row < arrayShape.
rows; ++row)
207 weightedArray.
begin(), multiplies);
209 const std::complex<double>
sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(),
210 std::complex<double>(0.0));
211 returnArray(0, row) =
sum / weightSum;
218 if (inWeights.
size() != inArray.shape().rows)
225 const Shape transShape = transposedArray.
shape();
226 double weightSum = inWeights.template astype<double>().
sum().
item();
228 for (
uint32 row = 0; row < transShape.
rows; ++row)
232 weightedArray.
begin(), multiplies);
234 const std::complex<double>
sum = std::accumulate(weightedArray.
begin(), weightedArray.
end(),
235 std::complex<double>(0.0));
236 returnArray(0, row) =
sum / weightSum;