MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
djmp at earthlink.net
http://home.earthlink.net/~djmp/



  • Prev by Date: Re: Can someone tell me why NDsolve isn't working here?
  • Next by Date: Re: Can someone tell me why NDsolve isn't working here?
  • Previous by thread: Re: ask for help on list operation
  • Next by thread: Mystery: NIntegrate'ing indeterminate-length integrand!