Skip to content

math: add promoted tensor power - #881

Merged
ulises-jeremias merged 2 commits into
vlang:mainfrom
ulises-jeremias:copilot/vtl-power-promoted-20261116
Nov 20, 2026
Merged

ulises-jeremias merged 2 commits into
vlang:mainfrom
ulises-jeremias:copilot/vtl-power-promoted-20261116

Conversation

@ulises-jeremias

@ulises-jeremias ulises-jeremias commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add pow_promoted for broadcasted tensor power with an explicit result dtype.
  • Numeric pairs use promote_types; boolean pairs return NumPy-compatible int8.
  • Preserve exact-width integer power and reject negative integer exponents and lossy 64-bit-integer-to-float casts.
  • Add regression tests, parity notes, a tutorial section, and a runnable example; this is a partial ufunc-parity slice related to issue feat(math): complete NumPy ufunc family coverage #777 and does not close it.
  • Merge current VTL main 87e226b to preserve current documentation and example updates.

Validation

  • The original implementation head's focused tests passed in debug and production; its formatter, Markdown check, and runnable example also passed.
  • Current-head validation for 1f8c46d is still pending: the focused formatter/test invocation is queued behind the shared local build lock, and refreshed hosted checks are pending. No current-head test pass is claimed.

Behavior notes

Complex and string inputs are unsupported. Boolean pairs return int8, matching NumPy. 64-bit integer inputs are rejected when the promoted output would be floating-point.

Add broadcasted tensor power with explicit NumPy-style promotion, exact-width integer arithmetic, and documented unsupported cases. Tests and a runnable example cover the public contract; this is a partial ufunc parity slice for vlang#777.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Align NumPy documentation and return int8 for boolean tensor power.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ulises-jeremias
ulises-jeremias marked this pull request as ready for review November 20, 2026 05:42
@ulises-jeremias
ulises-jeremias merged commit 98222d0 into vlang:main Nov 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant