# Using Set without unpacking an array

I'm trying to optimise my code by making us of packed array. However, it appears that using Set in combination with Part sometime unpacks the array, and sometimes leaves the array packed, even when the data you put in is of the same type.

When does Set unpack an array?

Here is an example:

• Please give examples of cases when it unpacks. It never unpacks for me when the type matches. – Szabolcs Oct 28 '16 at 16:05
• I added an example – user44136 Oct 28 '16 at 16:26
• {1., 0., 0.} is not packed. I suspect that if you give it packed, with DeveloperToPackedArray[{1., 0., 0.}], then init` will remain packed. Can you try this? – user31159 Oct 28 '16 at 16:28