Skip to content

Commit 3342c6a

Browse files
committed
median: add comments to common.fypp
1 parent bad19f8 commit 3342c6a

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/common.fypp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,20 @@ ${prefix + joinstr.join([line.strip() for line in txt.split("\n")]) + suffix}$
147147
#:endcall
148148
#:enddef
149149

150-
150+
#!
151+
#! Generates an array rank suffix for subarrays along a dimension
152+
#!
153+
#! Args:
154+
#! rank (int): Rank of the original variable
155+
#! dim (int): Dimension of the variable
156+
#!
157+
#! Returns:
158+
#! Array rank suffix string enclosed in braces
159+
#!
160+
#! E.g.,
161+
#! select_subvector(5, 2)
162+
#! -> (j_, :, j___, j____, j_____)
163+
#!
151164
#:def select_subvector(rank, idim)
152165
#:assert rank > 0
153166
#:call join_lines(joinstr=", ", prefix="(", suffix=")")
@@ -161,6 +174,20 @@ ${prefix + joinstr.join([line.strip() for line in txt.split("\n")]) + suffix}$
161174
#:endcall
162175
#:enddef
163176

177+
#!
178+
#! Generates an array rank suffix for arrays
179+
#!
180+
#! Args:
181+
#! rank (int): Rank of the original variable
182+
#! idim (int): Dimension of the variable
183+
#!
184+
#! Returns:
185+
#! Array rank suffix string enclosed in braces
186+
#!
187+
#! E.g.,
188+
#! select_subvector(5, 2)
189+
#! -> (j_, j___, j____, j_____)
190+
#!
164191
#:def reduce_subvector(rank, idim)
165192
#:assert rank > 0
166193
#:if rank > 1
@@ -175,6 +202,4 @@ ${prefix + joinstr.join([line.strip() for line in txt.split("\n")]) + suffix}$
175202
#:endif
176203
#:enddef
177204

178-
179-
180205
#:endmute

0 commit comments

Comments
 (0)