PackedArray Bug?

• To: mathgroup at smc.vnet.net
• Subject: [mg44050] PackedArray Bug?
• From: "David Park" <djmp at earthlink.net>
• Date: Sun, 19 Oct 2003 01:10:50 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Dear MathGroup,

Here is a piece of code that creates an array of 625 lists of 4 numbers. It
then calculates the Signature of a small selected set on the array.

baseindexset = Flatten[Array[{##} &, Table[5, {4}]], 3];
Module[{basepos},
Do[
basepos = Part[baseindexset, i];
Print[{basepos, Signature[basepos]}],
{i, 90, 95}]]

{{1,4,3,5},-1}

{{1,4,4,1},0}

{{1,4,4,2},1}

{{1,4,4,3},1}

{{1,4,4,4},1}

{{1,4,4,5},0}

The 3rd, 4th and 5th elements are clearly incorrect. The Signatures should
be zero because the lists have repeated elements.

But if we unpack the baseindexset, the Signatures are then calculated
correctly.

baseindexset =
Developer`FromPackedArray[Flatten[Array[{##} &, Table[5, {4}]], 3]];
Module[{basepos},
Do[
basepos = Part[baseindexset, i];
Print[{basepos, Signature[basepos]}],
{i, 90, 95}]]

{{1,4,3,5},-1}

{{1,4,4,1},0}

{{1,4,4,2},0}

{{1,4,4,3},0}

{{1,4,4,4},0}

{{1,4,4,5},0}

Isn't the first result a bug in that the result should not depend upon
whether the Array is packed?

Done on Version 5.0.

David Park