Questions tagged [packed-arrays]

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 usage.

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 usage.

Useful links:

Frequently asked questions:

76 questions
10
votes
1 answer

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 internal data-format, which optimizes memory usage…
reddish
  • 285
  • 1
  • 5
6
votes
1 answer

Unexpected unpacking of wrapped PackedArray

I'm confused as to why the following leads to unpacking of a PackedArray: Needs["Developer`"] On["Packing"] a = ToPackedArray@{RandomReal[], RandomReal[]}; a // PackedArrayQ (* returns True*) b f[a] b + f[a] Both of the last commands produce a…
TimRias
  • 3,160
  • 13
  • 17
5
votes
1 answer

Isn't it possible to Pack a SparseArray?

I have the following matrix Va: Va = Table[ Which[i == j + 1, 2, True, 0], {l, 1, 2}, {m, 1, 2}, {s, 1, 2}, {q, 1, 2}, {i, 1, 2}, {j, 1,2}]; There is no problem to pack it: Va =…
Mencia
  • 1,324
  • 12
  • 26
4
votes
1 answer

Can't initialise packed array of rational numbers

If I evaluate the following code t = Developer`ToPackedArray[{0, 2/7, -(1/7)}]; Developer`PackedArrayQ[t] Mathematica returns False. Is there any way that I can pack an array of rational numbers?
Gert
  • 1,530
  • 8
  • 22
3
votes
0 answers

Fixing a step size with a variable causes array to be unpacked?

I would expect the following code to produce a packed 11x11x11 element array of 64 bit integers, but it doesn't: A = 10; V = Table[1, {i, 0, 1, 1/A}, {j, 0, 1, 1/A}, {k, 0, 1, 1/A}] ; Developer`PackedArrayQ[V] (* returns false *) However, if we…
Bruce Bartlett
  • 455
  • 2
  • 7
3
votes
1 answer

Nested list can not be packed?

Why can't nested list be packed? In[252]:= ftest = {1., {3.}}; ftest = Developer`ToPackedArray[ftest]; Developer`PackedArrayQ[ftest] Out[254]= False
Al Guy
  • 1,610
  • 1
  • 10
  • 15