Packed Array Angst
- To: mathgroup at smc.vnet.net
- Subject: [mg20962] Packed Array Angst
- From: Mark Reeve <msreeve at earthlink.net>
- Date: Wed, 1 Dec 1999 01:50:29 -0500 (EST)
- Organization: EarthLink Network, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
Hello, This is mainly a question to WRI personnel, though I'd appreciate any thoughts anyone else might have as well. I've been experimenting with packed arrays and have observed that a number of common functional programming constructs force unpacking, thus greatly lessening the utility of packed arrays. At the latest Developers' Conference Tom Wickham-Jones mentioned that he was working on upgrades to allow the pattern matcher to work better with packed arrays and perhaps the problems I'm encountering are already on the list for generalization. For example: Transpose, Inner, Outer, and MapThread. The latter is particularly annoying. I should clarify that for a 2-D array (and possibly for higher-dimensions as well), Transpose[arr], works just fine and preserves packing. But if the user specifies a permutation vector, even the trivial Transpose[arr2d,{1,2}], unpacking occurs. Another nasty thing is that if "a" and "b" are two packed arrays, the composite c={a,b} is not, although c[[1]] and c[[2]] are still each packed. Has anyone found a way around some of these limitations? A generic replacement for MapThread which preserves packing? I have experimented with several forms but have so far only run into further limitations. -Mark