Function
Return a type, category, rank, and shape to which all of the Arrays can be converted.
Syntax
#include <dx/dx.h>
Error DXQueryArrayCommon(Type *type, Category *category, int *rank, int
*shape
int n, Array a, ...)
Error DXQueryArrayCommonV(Type *type, Category *category, int *rank, int
*shape
int n, Array *alist)
Functional Details
All Arrays a or alist are converted to a common type, category, rank, and shape if a common conversion exists. Both routines set *type, *category, *rank, and *shape to the new converted values if the pointers to these parameters are not NULL.
Arrays with items that have one or more dimensions of shape = 1 are reduced in that dimension to a smaller rank. For example, an array of 1 × n matrices, rank = 2, shape = [1,n], is reduced to an Array of vectors rank = 1, shape = [n]. This rank and shape are then used for comparison.
Note: | This reduction is always performed. The resulting rank may be less than the rank of all Arrays given. (A single 1 × n matrix results in a rank of 1.) Table 6 and Table 7 summarize the conversions allowed between types and between categories. |
The resulting rank and shape are the reduced versions created as previously described. The resulting type is the simplest type that is sufficient for all Arrays. The resulting category is the simplest category that is sufficient for all Arrays.
The
shape
Array
must be preallocated with sufficient memory to store the returned
rank
integers. This will not exceed the maximum rank of the given arrays.
Table 6. Summary of Type
Conversions
Byte | Unsigned Byte |
Short | Unsigned Short |
Int | Unsigned Int |
Float |
Double | |
---|---|---|---|---|---|---|---|---|
Byte | A | CNS | A | CNS | A | CNS | A | A |
Unsigned Byte | CNS | A | A | A | A | A | A | A |
Short | CNS | CNS | A | CNS | A | CNS | A | A |
Unsigned Short | CNS | CNS | CNS | A | A | A | A | A |
Int | CNS | CNS | CNS | CNS | A | CNS | A | A |
Unsigned Int | CNS | CNS | CNS | CNS | CNS | A | A | A |
Float | CNS | CNS | CNS | CNS | CNS | CNS | A | A |
Double | CNS | CNS | CNS | CNS | CNS | CNS | CNS | A |
Notes:
|
Table 7. Summary of
Category Conversions
Real | Complex | |
---|---|---|
Real | Conversion | Conversion |
Complex | CNS | Conversion |
Notes:
|
Return Value
Return OK and sets the non-NULL parameters; otherwise, returns ERROR and sets an error code.
See Also
DXArrayConvert, DXArrayConvertV, DXExtractFloat, DXExtractInteger, DXExtractNthString, DXExtractParameter, DXExtractString, DXQueryArrayConvert, DXQueryArrayConvertV, DXQueryParameter
12.8 , "Extracting Module Parameters".