Tag for questions about packed arrays. Packed Arrays are data structures that can be seen as monolithic blocks containing a single data type, particularly Integers and Reals. Many functions operate very efficient on packed arrays. Questions may deal with packed array generation, conversion, and ...
29
votes
2answers
859 views
What is a Mathematica packed array?
A simple sounding question with a few sub questions:
What is the difference between unpacked vs packed array?
Are packed arrays more space efficent, how much so?
Are packed arrays more time ...
20
votes
2answers
271 views
Are there guidelines for avoiding the unpacking of a packed array?
Packed arrays are very useful because they save memory and generally allow speedier and more efficient calculation times. If a list of data currently stored as a packed array is unpacked, it can slow ...
16
votes
2answers
345 views
Why does ImageData need four times more memory?
Background
We are dealing with very large TIFF image files that are imported, processed and exported using Mathematica 9. Many of our algorithms only work with an array representation of the images, ...
11
votes
2answers
119 views
How do you determine the optimal autocompilation length on your system
When you pack lists there is an overhead therefore packing a list with, say, 2 elements is likely to cost more than you get back in efficiency. Mathematica has default list lengths for which functions ...
10
votes
1answer
212 views
Why doesn't Mathematica pack Boolean arrays?
I've been wondering about this for a while now, so I'm going to ask. This is a question about the design of Mathematica, which perhaps cannot be directly answered by anyone but the designers, however ...
9
votes
2answers
262 views
Speeding up construction of simple tridiagonal matrix
I have the following code to construct a tridiagonal matrix:
...
9
votes
1answer
142 views
Future-proofing access to packed array tools
Most of the Mathematica users beyond beginner level will be aware of the phenomenon of Packed Arrays. The user-accessible functions related to packed arrays live in the ...
9
votes
1answer
126 views
Forcing efficient numerical arrays
I encounter strange behaviour of Mathematica when evaluating multi-dimensional arrays of double-precision data.
Mathematica can express large arrays of machine-precision numbers using a specialized ...
6
votes
4answers
154 views
Why does array packing in Table behave like this?
Consider the following example, which generate two identical arrays. Why sometimes the array is packed and sometimes it doesn't? And why they perform differently?
Here the arrays are packed:
...
6
votes
2answers
180 views
Fastest way to test if a numerical array has complex elements
I am looking for the fastest way to test whether an n-dimensional numerical (NumericQ) array (in the ArrayQ sense) is complex or ...
5
votes
3answers
224 views
Multidimensional array reduction through summation over one of its dimensions
1. Introduction
I am using an array of dimension 3 (might become more) to store some values. I would like to implement a function that takes as argument the array and a couple of numbers smaller than ...
3
votes
1answer
79 views
Discrepancy with TakeWhile between RandomInteger result and list on Linux
I have to following code that solves a problem for me. The example that is given to us is as follows:
lst = {1,-2, 3, 4,5,-3, -4, 9,7,0,8}, predicate = ...
2
votes
3answers
141 views
Use elements of Array inside function definition
I'm trying to define a function which modifies and sums over the elements of an array. Here is a very simplified version.
myF[kmax_] = Sum[v[[k]]/k, {k, 1, kmax}]
...
1
vote
1answer
162 views
How can I permute a multiset?
I have a multiset {1, 3, 3, 1, 2} and would like to randomly permute the classes like so: {2, 1, 1, 2, 3} or {3, 2, 2, 3, 1}, what is the simplest and most efficient way to do this?
In reality the ...


