compare elements inside two container structures - Maple Help

Online Help

All Products    Maple    MapleSim


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

EqualEntries - compare elements inside two container structures

Calling Sequence

EqualEntries(A,B);

Parameters

A

-

container object

B

-

container object

Description

• 

The EqualEntries command compares the elements of A with the elements of B.  EqualEntries('A','B') will return true when both A and B are the same kind of structure, have the same number of elements, and contain the same elements in the same order.  Some exceptions apply.

• 

When comparing tables, both tables must have the same index/value pairs.  The indices in both tables must be exactly the same.  That is, an index of 1.0 in one table will not compare equally with 1.00 in the other table.  The values at each index are compared using evalb.

• 

When comparing rtables, both structures must have the same number of dimensions, and the same bounds in each dimension.  If A and B are Vectors of differing orientation, EqualEntries will return false.  The values at each index are compared using evalb.

• 

When comparing lists, EqualEntries is applied recursively on the elements of the lists.  In this way, lists containing other mutable container objects like tables and rtables can be compared in a deeper way than what evalb does.

• 

When comparing sets, EqualEntries will verify that each element in set A has an equivalent entry in set B, and vice versa.  This means that sets A and B need not be the same size for EqualEntries to return true.  As one example, the set {1.0,1.00} is considered to have the same entries as {1.000}.

• 

Comparison of modules is currently undefined and may change in the future.

• 

All other data structures are directly compared using evalb.

Examples

a:=1,2,3

a:=123

(1)

b:=Vectorcolumn1,2,3

b:=123

(2)

EqualEntriesa,b

true

(3)

EqualEntries1.0,1.00,1.000,1.,1.,1.

true

(4)

t1:=tablecolor=red,size=4

t1:=tablecolor=red,size=4

(5)

t2:=tablecolor=red,size=5

t2:=tablecolor=red,size=5

(6)

EqualEntriest1,t2

false

(7)

t2size:=4

t2size:=4

(8)

EqualEntriest1,t2

true

(9)

EqualEntries1.0,1.00,1.

true

(10)

See Also

evalb, LinearAlgebra,Equal


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