indices - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : indices

indices

indices of a table or array

entries

entries of a table or array

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Compatibility

Calling Sequence

indices(t)

indices(t,options)

entries(t)

entries(t,options)

Parameters

t

-

table or Array

options

-

(optional) optional arguments to control the output format.

Description

• 

The indices and entries functions return sequences of the indices (or keys) and the entries respectively of the table or Array t corresponding to the entries that are explicitly stored.

• 

By default, the result returned is a sequence of lists in an apparently arbitrary order. However, there is a one-to-one correspondence between the result of indices and entries.  Users can specify the 'indexorder' option to control the order of the returned elements.

• 

indices and entries support the following optional arguments.

• 

If the 'nolist' option is used the result returned will be a simple sequence without lists.  This is useful for tables where every index or entry is a single object.  When 'nolist' is used on a table with expression sequence indices or entries, the pairings may be difficult to deduce in the result.

• 

If the 'pairs' option is used the result returned will be a sequence of index = entry pairs.  Since the equation form can represent sequences in either the index or entry part of the equation, neither each side nor the whole equation is wrapped in a list.

• 

If the 'indexorder' option is used the returned data will be ordered based on the sorted order of the indices.  The indices are sorted using the same algorithm as the sort command.  Users can also provide a comparison function to the 'indexorder' option.

Thread Safety

• 

The indices and entries commands are thread-safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

Examples

ttablegreen=gruen,red=rot,blue=blau,black=schwarz:

indicest

blue,red,green,black

(1)

entriest

blau,rot,gruen,schwarz

(2)

indicest,'nolist'

blue,red,green,black

(3)

indicest,'pairs'

blue=blau,red=rot,green=gruen,black=schwarz

(4)

indicest,indexorder

black,blue,green,red

(5)

entriest,indexorder

schwarz,blau,gruen,rot

(6)

indicest,indexorder=x,y→notStringTools:-Comparex1,y1

red,green,blue,black

(7)

aArray1,2,3,4

a:=1234

(8)

indicesa

1,1,2,1,1,2,2,2

(9)

entriesa

1,3,2,4

(10)

entriesa,'nolist'

1,3,2,4

(11)

mMatrix3,2,2,1,4,4,5,8

m:=214458

(12)

indicesm

1,1,2,1,3,1,1,2,2,2,3,2

(13)

entriesm

2,4,5,1,4,8

(14)

entriesm,'pairs'

1,1=2,1,2=1,2,1=4,2,2=4,3,1=5,3,2=8

(15)

Compatibility

• 

The pairs option was introduced in Maple 15.

• 

For more information on Maple 15 changes, see Updates in Maple 15.

• 

The indices and entries commands were updated in Maple 18.

• 

The indexorder option was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

Array

Matrix

op

table

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam