Commit 8b77207
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
- website
- docs
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1322 | 1322 | | |
1323 | 1323 | | |
1324 | 1324 | | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
1325 | 1335 | | |
1326 | 1336 | | |
1327 | 1337 | | |
| |||
0 commit comments