> < ^ From:

< ^ Subject:

Dear GAP-Forum,

Mathias Kratzer asked:

> is anyone able to explain the following results / error message? > > gap> G := GeneralLinearGroup(3,2);; G.name := "GL(3,2)";; > gap> chi1 := Irr(G)[2];; chi1.range; > Cyclotomics [...] > gap> chi3 := Copy( chi1 );; chi3.range; > Cyclotomics > gap> chi1.range = chi3.range; > Error, Record: element 'generators' must have an assigned value at [...] > > What went wrong in Copy( chi1 )?

Copy runs recursively through an object and copies all entries, in this case

creating a copy of `Cyclotomics'.

gap> IsIdentical(Cyclotomics,Copy(Cyclotomics));

false

This copy looks the same, but the equality

test (that treats the infinite domains in a special way as you cannot list

all elements and not always even a finite generating set) gets completely

confused.

The remedy is not to use `Copy' but only `ShallowCopy' (which only copies

the first level and does not descend recursively through the full data

structure). This not only avoids this problem of doppelgaengers but may also

save you substantial memory if larger data structures are stored within an

object.

In GAP4 this problem ceases to exist. Objects like the Cyclotomics are

immutable and even copying them will not duplicate the object:

( Gap4 example. `Copy' is called `StructuralCopy' here to avoid exactly this

type of confusion.

gap> IsIdenticalObj(Cyclotomics,StructuralCopy(Cyclotomics));

true

)

You can find a slightly more elaborate answer on this type of problem in

the Forum archive under:

http://www-gap.dcs.st-and.ac.uk/~gap/Forum/Theissen.1/Heiko.1/Re__Copy.1/1.html

Best regards,

Alexander Hulpke

> < [top]