Compute the linear interpolation weighted by gamma on each point of two same shape array. a : array_like Left bound. b : array_like Right bound. t : array_like The interpolation weight. out : array_like Output array.
(a, b, t, out=None)
| 4639 | |
| 4640 | |
| 4641 | def _lerp(a, b, t, out=None): |
| 4642 | """ |
| 4643 | Compute the linear interpolation weighted by gamma on each point of |
| 4644 | two same shape array. |
| 4645 | |
| 4646 | a : array_like |
| 4647 | Left bound. |
| 4648 | b : array_like |
| 4649 | Right bound. |
| 4650 | t : array_like |
| 4651 | The interpolation weight. |
| 4652 | out : array_like |
| 4653 | Output array. |
| 4654 | """ |
| 4655 | diff_b_a = subtract(b, a) |
| 4656 | # asanyarray is a stop-gap until gh-13105 |
| 4657 | lerp_interpolation = asanyarray(add(a, diff_b_a * t, out=out)) |
| 4658 | subtract(b, diff_b_a * (1 - t), out=lerp_interpolation, where=t >= 0.5, |
| 4659 | casting='unsafe', dtype=type(lerp_interpolation.dtype)) |
| 4660 | if lerp_interpolation.ndim == 0 and out is None: |
| 4661 | lerp_interpolation = lerp_interpolation[()] # unpack 0d arrays |
| 4662 | return lerp_interpolation |
| 4663 | |
| 4664 | |
| 4665 | def _get_gamma_mask(shape, default_value, conditioned_value, where): |
no test coverage detected