Skip to content

Commit f0aa935

Browse files
committed
Improve documentation.
1 parent 2a66d44 commit f0aa935

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

doc/add-instruction.rst

+18-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,24 @@ functionality to check arguments for correctness such as Python type.
7070

7171
By default, register arguments are understood as single registers. The
7272
:py:obj:`vectorize` decorator is an easy way to allow vector arguments
73-
if all register arguments have the same length. The vector size stored
74-
independently of the arguments.
73+
if all register arguments have the same length. The vector size is
74+
stored independently of the arguments. The decorator creates two
75+
instructions, a base version for single registers and a vectorized
76+
version, which is called as follows in the example for length
77+
:py:obj:`n`::
78+
79+
vprefixsum(n, result, operand)
80+
81+
At the higher level, the vector length is usually derived from the
82+
input using the :py:obj:`vectorize` decorator as in
83+
:py:func:`~Compiler.types.sint.prefix_sum`::
84+
85+
@vectorize
86+
def prefix_sum(self):
87+
""" Prefix sum. """
88+
res = sint()
89+
prefixsums(res, self)
90+
return res
7591

7692
All instruction classes should inherit from :py:obj:`Instruction` in
7793
:download:`../Compiler/instructions_base.py`.

0 commit comments

Comments
 (0)