"NumericArray" (Compiled Type)
"NumericArray"::[type,rank]
represents a numeric array type with elements of specified type and rank.
Details
- "NumericArray" can be used in Typed and related constructs to specify a type.
- "NumericArray" objects are automatically memory managed.
- "NumericArray" objects support the same element types as NumericArray.
Constructors
- NumericArray[{…},type] creates a numeric array with the specified element type.
- CreateTypeInstance["NumericArray"::[type,rank],array] constructs a copy of array.
- CreateTypeInstance["NumericArray"::[type,1],carr,len] constructs a numeric array from a "CArray" carr with length len. carr can optionally be wrapped in "Managed".
Properties
- Information[array,"ElementType"] for array of type "NumericArray"::[type,rank] gives type .
Conversions
- "NumericArray" objects can be converted to and from NumericArray expressions.
- "NumericArray" objects can be converted to and from "ListVector" objects.
Expressions
"ListVector"
Examples
open all close allBasic Examples (2)
"NumericArray" can be used as an input and output from a CompiledCodeFunction.
cf = FunctionCompile[Function[Typed[arg, TypeSpecifier["NumericArray"]["Integer64", 1]], arg]]cf[NumericArray[{1, 2, 3, 2}, "Integer64"]]Compile a function that returns a "NumericArray":
cf = FunctionCompile[Function[{}, NumericArray[{1, 2, 3, 4}, "Integer16"]]]cf[]Use Normal to convert the "NumericArray" to a list:
Normal[cf[]]Possible Issues (1)
Part access can cause an error while running the function. The computation is terminated, a message is issued and the Wolfram Engine is used to compute the result:
cf = FunctionCompile[Function[Typed[arg, TypeSpecifier["NumericArray"]["Integer64", 1]], arg[[5]]]];
cf[NumericArray[{1, 2, 3, 2}, "Integer64"]]See Also
NumericArray List Typed TypeSpecifier FunctionCompile
Compiled Types: Integer64 UnsignedInteger64 Real64 Real32 ComplexReal64 PackedArray ListVector SparseArray
Tech Notes
Related Guides
History
Introduced in 2019 (12.0) | Updated in 2022 (13.1)