SuggestedSubtype - Maple Help

ArrayTools

 SuggestedSubtype
 suggest rtable subtype for an operation on two rtables

 Calling Sequence SuggestedSubtype(X,Y,ndims)

Parameters

 X, Y - Array, hardware float, or general expression ndims - (optional) number of dimensions of result

Description

 • SuggestedSubtype(X,Y) accepts two rtables, X and Y, and suggests a subtype to use for a result involving an operation between X and Y.
 • The number of dimensions of the result of the operation can be passed as optional third argument ndims. If omitted, the number of dimensions is assumed to be the sum of the number of dimensions of X and Y.
 • If X or Y is a Vector or Matrix, and the number of dimensions of the result is 1 or 2, the suggested subtype will be a Vector or Matrix.
 • If neither X nor Y is a Vector or Matrix, or the number of dimensions of the result is 0 or more than 2, the suggested subtype will be Array.
 • This function is part of the ArrayTools package, so it can be used in the short form SuggestedSubtype(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[SuggestedSubtype](..).

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $\mathrm{M1}≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right)$
 ${\mathrm{M1}}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (1)
 > $\mathrm{SuggestedSubtype}\left(\mathrm{M1},x\right)$
 ${\mathrm{Matrix}}$ (2)
 > $\mathrm{V1}≔\mathrm{Vector}\left[\mathrm{column}\right]\left(\left[5,6\right]\right)$
 ${\mathrm{V1}}{≔}\left[\begin{array}{c}{5}\\ {6}\end{array}\right]$ (3)
 > $\mathrm{SuggestedSubtype}\left(\mathrm{M1},\mathrm{V1}\right)$
 ${\mathrm{Array}}$ (4)
 > $\mathrm{SuggestedSubtype}\left(\mathrm{M1},\mathrm{V1},1\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{column}}}$ (5)
 > $\mathrm{SuggestedSubtype}\left(\mathrm{M1},\mathrm{V1},2\right)$
 ${\mathrm{Matrix}}$ (6)

Compatibility

 • The ArrayTools[SuggestedSubtype] command was introduced in Maple 2021.