Sums elements of the input array, and returns the square(s) of that sum. Parameters ---------- a : array_like Input array. axis : int or None, optional Axis along which to calculate. Default is 0. If None, compute over the whole array `a`. Returns
(a, axis=0)
| 497 | |
| 498 | |
| 499 | def _square_of_sums(a, axis=0): |
| 500 | """ |
| 501 | Sums elements of the input array, and returns the square(s) of that sum. |
| 502 | Parameters |
| 503 | ---------- |
| 504 | a : array_like |
| 505 | Input array. |
| 506 | axis : int or None, optional |
| 507 | Axis along which to calculate. Default is 0. If None, compute over |
| 508 | the whole array `a`. |
| 509 | Returns |
| 510 | ------- |
| 511 | square_of_sums : float or ndarray |
| 512 | The square of the sum over `axis`. |
| 513 | See also |
| 514 | -------- |
| 515 | _sum_of_squares : The sum of squares (the opposite of `square_of_sums`). |
| 516 | """ |
| 517 | s = da.sum(a, axis) |
| 518 | return s * s |