Reference Guide > C Routines > CPROD Function
  

CPROD Function
Standard Library function that returns the Cartesian product of some arrays.
enabled.
Usage
result = CPROD(a)
Input Parameters
aA list of n arrays.
Returned Value
result—An (m,n) array where result(i,*) is an element of the Cartesian product of the n arrays in a, and where result(*,j) contains only elements from a(j); result is ordered so that result(*,j) cycles through the elements of a(j) in order, and does so faster than result(*,j+1) cycles through the elements of a(j+1).
Keywords
None.
Example
PM, CPROD( LIST( [0,1], [0,1,2], [0,1,2,3] ) )
; PV-WAVE prints:
;       0       0       0
;       1       0       0
;       0       1       0
;       1       1       0
;       0       2       0
;       1       2       0
;       0       0       1
;       1       0       1
;       0       1       1
;       1       1       1
;       0       2       1
;       1       2       1
;       0       0       2
;       1       0       2
;       0       1       2
;       1       1       2
;       0       2       2
;       1       2       2
;       0       0       3
;       1       0       3
;       0       1       3
;       1       1       3
;       0       2       3
;       1       2       3
See Also
alibCartProd

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.