Content-Length: 303468 | pFad | http://github.com/numpy/numpy/pull/28891

D4 DOC: Add examples to broadcasting documentation for 2D and 3D array cases by yamato1936 · Pull Request #28891 · numpy/numpy · GitHub
Skip to content

DOC: Add examples to broadcasting documentation for 2D and 3D array cases #28891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yamato1936
Copy link

This pull request adds two new examples to doc/source/user/basics.broadcasting.rst to provide additional clarity on how broadcasting works in NumPy.

Added Examples:

  • Broadcasting (3, 1) and (1, 4)
    Demonstrates how arrays with shapes (3, 1) and (1, 4) broadcast to shape (3, 4).

  • Broadcasting (2, 3, 1) and (3, 4)
    Explains how a (2, 3, 1) array and a (3, 4) array broadcast to shape (2, 3, 4).

Purpose:

These examples are intended to help users—especially those new to broadcasting—better understand how NumPy's broadcasting rules apply in practical scenarios.

Notes:

  • Type of change: Documentation-only update
  • No changes were made to the codebase or functionality.

@jorenham jorenham changed the title Add examples to broadcasting documentation for 2D and 3D array cases DOC: Add examples to broadcasting documentation for 2D and 3D array cases May 3, 2025
@melissawm melissawm moved this to Awaiting a code review in NumPy first-time contributor PRs May 6, 2025
Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yamato1936 - thanks for the contribution! I think these examples belong right before the Vector Quantization example, actually - that's where we have general numerical examples of broadcasting. We could have a subsection called "Additional examples" and move them there. What do you think?

@yamato1936
Copy link
Author

Hi @melissawm -Thanks for the feedback! That makes sense — placing them before the Vector Quantization example under a new "Additional examples" subsection sounds like a cleaner structure.

Just to confirm — would it be alright if I go ahead and make that change myself, or would you prefer to handle the restructuring on your end?

Let me know if you have any suggestions on naming or formatting as well!

@melissawm
Copy link
Member

Yes please go ahead and make the changes in your next commit to this same branch, and that's what we'll merge. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Awaiting a code review
Development

Successfully merging this pull request may close these issues.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/numpy/numpy/pull/28891

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy