ArrayTools - Maple Programming Help

Home : Support : Online Help : Programming : Low-level Manipulation : Matrices, Vectors, and Arrays : ArrayTools : ArrayTools/MultiplyAlongDimension

ArrayTools

 MultiplyAlongDimension
 multiply the elements of an Array

 Calling Sequence MultiplyAlongDimension(M) MultiplyAlongDimension(M, dim)

Parameters

 M - Matrix, Vector, or Array dim - (optional); dimension in which to multiply the elements

Description

 • The MultiplyAlongDimension command multiplies together the elements in dimension dim of a N-dimensional Array to produce an Array with (N-1) dimensions.
 • When dim is not specified, the first non-singleton dimension is used for multiplying.  If the dimension specified is a higher dimension than the number of dimensions in the input, the input itself will be returned.
 • If MultiplyAlongDimension is applied to a Vector, a constant will be returned.
 • This function is part of the ArrayTools package, so it can be used in the short form MultiplyAlongDimension(..) only after executing the command with(ArrayTools. However, it can always be accessed through the long form of the command by using ArrayTools[MultiplyAlongDimension](..).

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $M≔\mathrm{Matrix}\left(\left[\left[a,b,c\right],\left[d,e,f\right]\right]\right)$
 ${M}{:=}\left[\begin{array}{ccc}{a}& {b}& {c}\\ {d}& {e}& {f}\end{array}\right]$ (1)
 > $\mathrm{MultiplyAlongDimension}\left(M,1\right)$
 $\left[\begin{array}{ccc}{a}{}{d}& {b}{}{e}& {c}{}{f}\end{array}\right]$ (2)
 > $\mathrm{MultiplyAlongDimension}\left(M,2\right)$
 $\left[\begin{array}{c}{a}{}{b}{}{c}\\ {d}{}{e}{}{f}\end{array}\right]$ (3)
 > $v≔\mathrm{Vector}\left(\left[1,2,3,4\right]\right)$
 ${v}{:=}\left[\begin{array}{r}{1}\\ {2}\\ {3}\\ {4}\end{array}\right]$ (4)
 > $\mathrm{MultiplyAlongDimension}\left(v\right)$
 ${24}$ (5)