create a duplicate table or rtable - Maple Help

Online Help

All Products    Maple    MapleSim


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

copy - create a duplicate table or rtable

Calling Sequence

copy( a );

Parameters

a

-

any expression

Description

• 

The purpose of the copy function is to create a duplicate table (or rtable) which can be altered without changing the original table (or rtable).  If a is not a table (or rtable), a is returned.

• 

This functionality is necessary since the statements s := table(); t := s; leave both names s and t evaluating to the same table structure.  Hence, unlike other Maple data structures, assignments made via one of the names affect the values associated with the other name as well.

• 

Note that copy is not recursive.  This means that if a is a table of tables, the table data structure for a is copied but the table structures for the entries of a are not copied.

• 

For an rtable, copy preserves rtable options and indexing functions, except for the readonly option which is not set.

Examples

s1:=x

s1:=x

(1)

t:=s

t:=s

(2)

t1:=y

t1:=y

(3)

s1

y

(4)

u:=copys

u:=table1=y

(5)

u1:=z

u1:=z

(6)

s1

y

(7)

m:=Matrix1,shape=symmetric,a,readonly

m:=a

(8)

MatrixOptionsm

shape=symmetric,datatype=anything,storage=triangularupper,order=Fortran_order,readonly

(9)

n:=copym

n:=a

(10)

MatrixOptionsn

shape=symmetric,datatype=anything,storage=triangularupper,order=Fortran_order

(11)

For a table 'a' that contains another table 'b'; when copy is done on 'a' an entirely new copy of 'a' is created.  However the objects contained in the table are not duplicated; so both 'a' and the copy of 'a' contain the table 'b'. Thus, if a change is made to the table 'b' in 'a', that change will show up in the copy of 'a' as well, and vice versa.

S:=table45,tablesymmetric,1,2=3

S:=table1=45,2=tablesymmetric,1,2=3

(12)

S1

45

(13)

T:=copyS

T:=table1=45,2=tablesymmetric,1,2=3

(14)

T1

45

(15)

T1:=50

T1:=50

(16)

S1

45

(17)

S22,1

3

(18)

T22,1:=5

T22,1:=5

(19)

S22,1

5

(20)

See Also

Array, Matrix, rtable, table, Vector


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