You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/index.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,3 +116,38 @@ We then also use `ArrayMargins` to check whether the margins of this array are i
116
116
```@example ex
117
117
ArrayMargins(Z, dimid)
118
118
```
119
+
120
+
## Repeated margins
121
+
122
+
With multidimensional margins, it is also possible to enter a single margin multiple times in different target margins. This is allowed as long as the margin totals match, and as long as no two target margins are about the exact same dimensions. For example:
123
+
124
+
```@example ex
125
+
# Create a 2×3×4 array with seed value 1
126
+
initial_array = ones(2, 3, 4)
127
+
128
+
# Specify target margins for dimensions 1 and 3
129
+
tgt_13 = [
130
+
10.0 15.0 20.0 25.0;
131
+
30.0 35.0 40.0 45.0
132
+
]
133
+
134
+
# Specify target margins for dimensions 2 and 3
135
+
tgt_23 = [
136
+
12.0 16.0 20.0 24.0;
137
+
18.0 22.0 26.0 30.0;
138
+
10.0 12.0 14.0 16.0
139
+
]
140
+
141
+
# dimension 3 occurs twice!
142
+
target_dims = [[1, 3], [2, 3]]
143
+
target_margins = [tgt_13, tgt_23]
144
+
145
+
# at this point, the margins are checked for consistency
0 commit comments