StructuredArray

As of Version 12.1, the generic StructuredArray object has been superseded by individual types such as QuantityArray and SymmetrizedArray.

StructuredArray[st,{d1,d2,},data]

represents a d1×d2× array with structure type st and specific content data.

Details

  • A structured array object created in earlier versions of the Wolfram Language will be converted to an appropriate, type-specific object upon evaluation.
  • Normal[sa] gives the ordinary array corresponding to a structured array object.
  • SparseArray[sa] gives a sparse array corresponding to a structured array object.
  • The elements in a structured array need not be numeric.
  • The individual elements of a structured array cannot themselves be lists.
  • List and matrix operations are typically set up to work as they do for corresponding normal array.
  • Functions with attribute Listable are automatically threaded over the individual elements of the ordinary arrays represented by structured arrays. If the function is not supported for the structure type, then the result will be returned as an ordinary or sparse array.
  • Part extracts specified parts of the array represented by a structured array object, rather than parts of the expression itself.
  • Structured arrays are treated as a raw object by functions like AtomQ and for purposes of pattern matching.
  • Dimensions gives the dimensions of a structured array.

Examples

open allclose all

Basic Examples  (3)

StructuredArray objects from versions prior to 12.1 are converted to new, specific types:

Create a list containing both sparse and structured arrays:

Normalize the structured arrays but not the sparse array in this list:

Represent an array based on symmetries:

Convert it to the ordinary representation:

Compare the memory required for the two representations:

Scope  (2)

By default, ArrayDepth computes depths for all types of arrays:

Compute depths only for List objects, so the QuantityArray object is considered to have depth 0:

Compute depths for both lists and structured array objects:

Represent an array based on symmetries:

Multiply each element of the array by 2:

Add the two arrays:

Subtract from 3s and convert to a sparse array:

Differentiate the array with respect to x; the symmetry is preserved:

Properties & Relations  (1)

Use MatrixForm and TableForm to display all the entries of a StructuredArray:

Introduced in 2012
 (9.0)