(
A,
order=2,
sum=chunk.sum,
numel=numel,
dtype="f8",
computing_meta=False,
implicit_complex_dtype=False,
**kwargs,
)
| 422 | |
| 423 | |
| 424 | def moment_chunk( |
| 425 | A, |
| 426 | order=2, |
| 427 | sum=chunk.sum, |
| 428 | numel=numel, |
| 429 | dtype="f8", |
| 430 | computing_meta=False, |
| 431 | implicit_complex_dtype=False, |
| 432 | **kwargs, |
| 433 | ): |
| 434 | if computing_meta: |
| 435 | return A |
| 436 | n = numel(A, **kwargs) |
| 437 | |
| 438 | n = n.astype(np.int64) |
| 439 | if implicit_complex_dtype: |
| 440 | total = sum(A, **kwargs) |
| 441 | else: |
| 442 | total = sum(A, dtype=dtype, **kwargs) |
| 443 | |
| 444 | with np.errstate(divide="ignore", invalid="ignore"): |
| 445 | u = total / n |
| 446 | d = A - u |
| 447 | if np.issubdtype(A.dtype, np.complexfloating): |
| 448 | d = np.abs(d) |
| 449 | xs = [sum(d**i, dtype=dtype, **kwargs) for i in range(2, order + 1)] |
| 450 | M = np.stack(xs, axis=-1) |
| 451 | return {"total": total, "n": n, "M": M} |
| 452 | |
| 453 | |
| 454 | def _moment_helper(Ms, ns, inner_term, order, sum, axis, kwargs): |
no test coverage detected