For each index of dimensions 0..n-2, this function computes the product of the n-1 dimension.
function dim_product( x : numeric )
begin ; ; Create example array ; a = onedtond(ispan(1,150,1),(/3,5,10/)) ; ; Assign dimension names ; a!0 = "x" a!1 = "y" a!2 = "z" ; ; Compute product of dimension z at all points x and y ; pxy = dim_product(a) ; ; Compute product of dimension x at all points y and z ; The following uses Named Subscripting to reorder the input array ; such that x is the n-1 dimension. ; pyz = dim_product( a(y | :, z | : , x | :) ) end
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?