@@ -71,48 +71,45 @@ Examples
71
71
The following examples demonstrate the application of the broadcasting algorithm for two compatible arrays.
72
72
73
73
::
74
- A (4d array): 8 x 1 x 6 x 1
75
- B (3d array): 7 x 1 x 5
76
- ---------------------------------
77
- Result (4d array): 8 x 7 x 6 x 5
78
74
79
- A (2d array): 5 x 4
80
- B (1d array): 1
81
- -------------------------
82
- Result (2d array): 5 x 4
83
-
84
- A (2d array): 5 x 4
85
- B (1d array): 4
86
- -------------------------
87
- Result (2d array): 5 x 4
88
-
89
- A (3d array): 15 x 3 x 5
90
- B (3d array): 15 x 1 x 5
91
- ------------------------------
92
- Result (3d array): 15 x 3 x 5
93
-
94
- A (3d array): 15 x 3 x 5
95
- B (2d array): 3 x 5
96
- ------------------------------
97
- Result (3d array): 15 x 3 x 5
98
-
99
- A (3d array): 15 x 3 x 5
100
- B (2d array): 3 x 1
101
- ------------------------------
102
- Result (3d array): 15 x 3 x 5
75
+ A (4d array): 8 x 1 x 6 x 1
76
+ B (3d array): 7 x 1 x 5
77
+ -------- -------------------------
78
+ Result (4d array): 8 x 7 x 6 x 5
79
+ A (2d array): 5 x 4
80
+ B (1d array): 1
81
+ -------------------------
82
+ Result (2d array): 5 x 4
83
+ A (2d array): 5 x 4
84
+ B (1d array): 4
85
+ -------------------------
86
+ Result (2d array): 5 x 4
87
+ A (3d array): 15 x 3 x 5
88
+ B (3d array): 15 x 1 x 5
89
+ ------------------------------
90
+ Result (3d array): 15 x 3 x 5
91
+ A (3d array): 15 x 3 x 5
92
+ B (2d array): 3 x 5
93
+ ------------------------------
94
+ Result (3d array): 15 x 3 x 5
95
+ A (3d array): 15 x 3 x 5
96
+ B (2d array): 3 x 1
97
+ ------------------------------
98
+ Result (3d array): 15 x 3 x 5
103
99
104
100
105
101
The following examples demonstrate array shapes which do **not ** broadcast.
106
102
107
103
::
108
- A (1d array): 3
109
- B (1d array): 4 # dimension does not match
110
104
111
- A (2d array): 2 x 1
112
- B (3d array): 8 x 4 x 3 # second dimension does not match
105
+ A (1d array): 3
106
+ B (1d array): 4 # dimension does not match
107
+
108
+ A (2d array): 2 x 1
109
+ B (3d array): 8 x 4 x 3 # second dimension does not match
113
110
114
- A (3d array): 15 x 3 x 5
115
- B (2d array): 15 x 3 # singleton dimensions can only be prepended, not appended
111
+ A (3d array): 15 x 3 x 5
112
+ B (2d array): 15 x 3 # singleton dimensions can only be prepended, not appended
116
113
117
114
In-place Semantics
118
115
------------------
0 commit comments