Skip to content

Commit 8b77207

Browse files
committed
docs: add comprehensive Broadcasting guide
Create in-depth, conversational documentation for NumPy-style broadcasting: - Opens with motivation: the problem broadcasting solves (avoiding loops) - Explains the core idea before diving into rules - The Three Rules with visual alignment examples - Multiple worked examples: - Scalar + Array - Row + Column (outer product pattern) - Matrix + Row vector (centering data) - Matrix + Column vector - Higher dimensions (batched operations) - NumSharp broadcasting functions: - np.broadcast_to() with compatibility rules - np.broadcast_arrays() for explicit broadcasting - Implicit broadcasting in operations - Why views matter (memory efficiency, read-only behavior) - Common pitfalls: - Shape mismatch errors and how to debug - Row vs column confusion - Accidentally broadcasting - Memory explosion risks - Performance considerations - How NumSharp implements it (stride manipulation) - Quick reference tables for compatible/incompatible shapes Written in conversational tone that explains "why" not just "what".
1 parent c1b7f84 commit 8b77207

8 files changed

Lines changed: 1064 additions & 99 deletions

File tree

docs/website-src/docs/broadcasting.md

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.

docs/website-src/docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- name: Introduction
22
href: intro.md
3+
- name: Broadcasting
4+
href: broadcasting.md
35
- name: NumPy Compliance & Compatibility
46
href: compliance.md
57
- name: Array API Standard

docs/website/docs/broadcasting.html

Lines changed: 500 additions & 0 deletions
Large diffs are not rendered by default.

docs/website/docs/toc.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<li>
1616
<a href="intro.html" name="" title="Introduction">Introduction</a>
1717
</li>
18+
<li>
19+
<a href="broadcasting.html" name="" title="Broadcasting">Broadcasting</a>
20+
</li>
1821
<li>
1922
<a href="compliance.html" name="" title="NumPy Compliance &amp; Compatibility">NumPy Compliance &amp; Compatibility</a>
2023
</li>

docs/website/docs/toc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
{"items":[{"name":"Introduction","href":"intro.html","topicHref":"intro.html"},{"name":"NumPy Compliance & Compatibility","href":"compliance.html","topicHref":"compliance.html"},{"name":"Array API Standard","href":"array-api-standard.html","topicHref":"array-api-standard.html"},{"name":"Extending Libraries","href":"extensions/index.html","topicHref":"extensions/index.html","items":[{"name":"NumSharp.Bitmap","href":"extensions/bitmap.html","topicHref":"extensions/bitmap.html"}],"expanded":false}]}
2+
{"items":[{"name":"Introduction","href":"intro.html","topicHref":"intro.html"},{"name":"Broadcasting","href":"broadcasting.html","topicHref":"broadcasting.html"},{"name":"NumPy Compliance & Compatibility","href":"compliance.html","topicHref":"compliance.html"},{"name":"Array API Standard","href":"array-api-standard.html","topicHref":"array-api-standard.html"},{"name":"Extending Libraries","href":"extensions/index.html","topicHref":"extensions/index.html","items":[{"name":"NumSharp.Bitmap","href":"extensions/bitmap.html","topicHref":"extensions/bitmap.html"}],"expanded":false}]}

docs/website/index.json

Lines changed: 5 additions & 0 deletions
Large diffs are not rendered by default.

docs/website/manifest.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,16 @@
13221322
},
13231323
"version": ""
13241324
},
1325+
{
1326+
"type": "Conceptual",
1327+
"source_relative_path": "docs/broadcasting.md",
1328+
"output": {
1329+
".html": {
1330+
"relative_path": "docs/broadcasting.html"
1331+
}
1332+
},
1333+
"version": ""
1334+
},
13251335
{
13261336
"type": "Conceptual",
13271337
"source_relative_path": "docs/compliance.md",

0 commit comments

Comments
 (0)