pystencils.sympyextensions.math.symmetric_product

pystencils.sympyextensions.math.symmetric_product#

pystencils.sympyextensions.math.symmetric_product(*args, with_diagonal=True)#

Similar to itertools.product but yields only values where the index is ascending i.e. values below/up to diagonal

Return type:

Iterable

Parameters:

with_diagonal (bool)

Examples

>>> list(symmetric_product([1, 2, 3], ['a', 'b', 'c']))
[(1, 'a'), (1, 'b'), (1, 'c'), (2, 'b'), (2, 'c'), (3, 'c')]
>>> list(symmetric_product([1, 2, 3], ['a', 'b', 'c'], with_diagonal=False))
[(1, 'b'), (1, 'c'), (2, 'c')]