sparse - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : indexing functions : indexfcn/sparse

sparse

The Sparse Indexing Function

 

Calling Sequence

Description

Examples

Compatibility

Calling Sequence

table(sparse, ...)

table(sparse=XXX, ...)

array(sparse, ...)

Description

• 

The sparse indexing function is used to create a table or an array with a sparse representation, meaning that only nonzero elements are stored in the underlying data structure.

• 

The sparse indexing function specifies that unassigned entries of a table or an array have the value 0. For example, array(sparse, 1..2, 1..2) is a zero matrix.

• 

If T is a table and j is an unevaluated name, then T[j] returns unevaluated. However, if j evaluates to an integer, then T[j] returns either the value of T[j] or 0 if T[j] has no assigned value.

• 

A default value other than zero can be used when constructing a sparse table.  The command, table(sparse=XXX), creates a table filled with XXXs at each entry.  This option is only available for tables.

• 

Note: The command array has been superseded by Array.

Examples

Ttablesparse,A=a:

TA

a

(1)

TB

0

(2)

aarraysparse,1..2:

a1

0

(3)

aj

aj

(4)

Ttablesparse=undefined,1=1,2=2:

T1

1

(5)

T100

undefined

(6)

Compatibility

• 

The sparse indexing function was updated in Maple 2019.

• 

The sparse=XXX option was updated in Maple 2019.

See Also

indexfcn

sparse