NumericArrayQ

NumericArrayQ[expr]

gives True if expr is a valid NumericArray object, and False otherwise.

NumericArrayQ[expr, tpatt]

requires additionally that NumericArrayType[expr] match the pattern tpatt.

NumericArrayQ[expr,tpatt,dpatt]

requires additionally that ArrayDepth[expr] match the pattern dpatt.

Examples

open allclose all

Basic Examples  (2)

A valid NumericArray object:

An expression with head NumericArray that is not a valid byte array object:

Scope  (7)

Include a test for the type:

Check to see if the type is a real type:

Check to see if the type is either a machine integer or real type:

Include a test for the array depth:

Allow depth up to 2:

Require depth greater than or equal to 2:

Constrain both the depth and the number type:

Possible Issues  (1)

The default conversion method will fail when the input array contains numbers that are out of range for the specified type.

Try to store in an "Integer8" numeric array:

Use the "ClipAndCoerce" method to automatically clip to the smallest "Integer8":

Wolfram Research (2019), NumericArrayQ, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericArrayQ.html.

Text

Wolfram Research (2019), NumericArrayQ, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericArrayQ.html.

CMS

Wolfram Language. 2019. "NumericArrayQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NumericArrayQ.html.

APA

Wolfram Language. (2019). NumericArrayQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumericArrayQ.html

BibTeX

@misc{reference.wolfram_2024_numericarrayq, author="Wolfram Research", title="{NumericArrayQ}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/NumericArrayQ.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_numericarrayq, organization={Wolfram Research}, title={NumericArrayQ}, year={2019}, url={https://reference.wolfram.com/language/ref/NumericArrayQ.html}, note=[Accessed: 22-December-2024 ]}