Skip to content

Commit 7dfd5c6

Browse files
committed
regenerate the manual
1 parent 1619244 commit 7dfd5c6

19 files changed

+7923
-3610
lines changed

doc/devdocs/cartesian.rst

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -138,72 +138,82 @@ Macro reference
138138

139139
.. function:: @nloops N itersym rangeexpr bodyexpr
140140

141-
::
142-
@nloops N itersym rangeexpr preexpr bodyexpr
143-
@nloops N itersym rangeexpr preexpr postexpr bodyexpr
144-
145-
Generate ``N`` nested loops, using ``itersym`` as the prefix for
146-
the iteration variables. ``rangeexpr`` may be an
147-
anonymous-function expression, or a simple symbol ``var`` in which
148-
case the range is ``1:size(var,d)`` for dimension ``d``.
149-
150-
Optionally, you can provide "pre" and "post" expressions. These
151-
get executed first and last, respectively, in the body of each
152-
loop. For example,
153-
::
154-
155-
@nloops 2 i A d->j_d=min(i_d,5) begin
156-
s += @nref 2 A j
157-
end
158-
159-
would generate
160-
::
161-
162-
for i_2 = 1:size(A, 2)
163-
j_2 = min(i_2, 5)
164-
for i_1 = 1:size(A, 1)
165-
j_1 = min(i_1, 5)
166-
s += A[j_1,j_2]
167-
end
168-
end
169-
170-
If you want just a post-expression, supply
171-
``nothing`` for the pre-expression. Using parenthesis and
172-
semicolons, you can supply multi-statement expressions.
141+
.. Docstring generated from Julia source
142+
.. code-block:: julia
143+
@nloops N itersym rangeexpr bodyexpr
144+
@nloops N itersym rangeexpr preexpr bodyexpr
145+
@nloops N itersym rangeexpr preexpr postexpr bodyexpr
146+
147+
Generate ``N`` nested loops, using ``itersym`` as the prefix for the iteration variables. ``rangeexpr`` may be an anonymous-function expression, or a simple symbol ``var`` in which case the range is ``1:size(var,d)`` for dimension ``d``\ .
148+
149+
Optionally, you can provide "pre" and "post" expressions. These get executed first and last, respectively, in the body of each loop. For example, :
150+
151+
.. code-block:: julia
152+
@nloops 2 i A d->j_d=min(i_d,5) begin
153+
s += @nref 2 A j
154+
end
155+
156+
would generate :
157+
158+
.. code-block:: julia
159+
for i_2 = 1:size(A, 2)
160+
j_2 = min(i_2, 5)
161+
for i_1 = 1:size(A, 1)
162+
j_1 = min(i_1, 5)
163+
s += A[j_1,j_2]
164+
end
165+
end
166+
167+
If you want just a post-expression, supply ``nothing`` for the pre-expression. Using parenthesis and semicolons, you can supply multi-statement expressions.
173168

174169
.. function:: @nref N A indexexpr
175170

176-
Generate expressions like ``A[i_1,i_2,...]``. ``indexexpr`` can
177-
either be an iteration-symbol prefix, or an anonymous-function
178-
expression.
171+
.. Docstring generated from Julia source
172+
.. code-block:: julia
173+
@nref N A indexexpr
174+
175+
Generate expressions like ``A[i_1,i_2,...]``\ . ``indexexpr`` can either be an iteration-symbol prefix, or an anonymous-function expression.
179176

180177
.. function:: @nexprs N expr
181178

182-
Generate ``N`` expressions. ``expr`` should be an
183-
anonymous-function expression.
179+
.. Docstring generated from Julia source
180+
.. code-block:: julia
181+
@nexprs N expr
182+
183+
Generate ``N`` expressions. ``expr`` should be an anonymous-function expression.
184184

185185
.. function:: @ntuple N expr
186186

187-
Generates an ``N``-tuple. ``@ntuple 2 i`` would generate ``(i_1, i_2)``, and ``@ntuple 2 k->k+1`` would generate ``(2,3)``.
187+
.. Docstring generated from Julia source
188+
.. code-block:: julia
189+
@ntuple N expr
190+
191+
Generates an ``N``\ -tuple. ``@ntuple 2 i`` would generate ``(i_1, i_2)``\ , and ``@ntuple 2 k->k+1`` would generate ``(2,3)``\ .
188192

189193
.. function:: @nall N expr
190194

191-
``@nall 3 d->(i_d > 1)`` would generate the expression
192-
``(i_1 > 1 && i_2 > 1 && i_3 > 1)``. This can be convenient for
193-
bounds-checking.
195+
.. Docstring generated from Julia source
196+
.. code-block:: julia
197+
@nall N expr
198+
199+
``@nall 3 d->(i_d > 1)`` would generate the expression ``(i_1 > 1 && i_2 > 1 && i_3 > 1)``\ . This can be convenient for bounds-checking.
194200

195201
.. function:: @nif N conditionexpr expr
196202

197-
::
198-
@nif N conditionexpr expr elseexpr
203+
.. Docstring generated from Julia source
204+
.. code-block:: julia
205+
@nif N conditionexpr expr
206+
@nif N conditionexpr expr elseexpr
199207
200-
Generates a sequence of ``if ... elseif ... else ... end`` statements. For example::
208+
Generates a sequence of ``if ... elseif ... else ... end`` statements. For example:
201209

202-
@nif 3 d->(i_d >= size(A,d)) d->(error("Dimension ", d, " too big")) d->println("All OK")
210+
.. code-block:: julia
211+
@nif 3 d->(i_d >= size(A,d)) d->(error("Dimension ", d, " too big")) d->println("All OK")
203212
204-
would generate::
213+
would generate:
205214

206-
if i_1 > size(A, 1)
215+
.. code-block:: julia
216+
if i_1 > size(A, 1)
207217
208218
error("Dimension ", 1, " too big")
209219
elseif i_2 > size(A, 2)

0 commit comments

Comments
 (0)