Sometimes you wish to perform an operation on only a subset of the elements of a vector or matrix. In the following example, we wish to compute the absolute value of a vector A:
A < 0
is a vector condition. In parallel, every element of A is
compared with 0, resulting in a boolean value (true or false). (Thus,
the result of such a comparison is a booleanVector). The subset of
elements (virtual processors) where the expression was true
executes the then clause. The subset of elements (virtual
processors) where the expression was false executes the
else clause, if any. In this example, every element of B
will be assigned some value, either -A or A, as appropriate. Note
that both clauses are always executed; it's just that a different set
of virtual processors are active in each clause.
Here's another example:
ifp() may be nested. Each ifp reduces the size of the set of virtual processors that are active. Thus, in