# Why can't we resize a reinterpreted matrix?

**URL:** https://discourse.julialang.org/t/why-cant-we-resize-a-reinterpreted-matrix/84780
**Category:** General Usage
**Created:** [July 26, 2022, 12:23am UTC](https://discourse.julialang.org/t/why-cant-we-resize-a-reinterpreted-matrix/84780 "2022-07-26T00:23:23Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [July 26, 2022, 9:17am UTC](https://discourse.julialang.org/t/why-cant-we-resize-a-reinterpreted-matrix/84780/3 "2022-07-26T09:17:10Z")

</div>

Even if the parent array were a `Vector`, you couldn’t resize the `reinterpret`ed array. `reinterpret` made a `Base.ReinterpretArray`, a wrapper struct with a `.parent` field referencing the parent array, so it doesn’t actually own its data. If you want to resize it, you have to change the parent array in 1 of 2 unsavory ways:

1. Resize the parent array implicitly, and I can’t justify mutating any instance implicitly.
2. Append data to the underlying buffer just for the `ReinterpretArray`, but now you have to disallow resizing the parent array or else you would corrupt the data belonging to the `ReinterpretArray`.

That’s not to say that you’re restricted from doing all unsafe things with shared buffers; you can [mutate the parent array in ways that changes the wrappers](https://discourse.julialang.org/t/push-to-reshape-d-vector-unshares-data-with-parent-array/84664/9). It’s just in this case your parent array is not 1-dimensional, so you can’t resize it. The linked github issue in the last comment ended on a question I really want answered, though; I had always assumed they drew the resizability line at vectors because appending data for N-1 dimensions along 1 specific dimension would be too large and inflexible a behavior, but it reads like there’s a whole other dimension to the issue.

---

_[View the full topic](https://discourse.julialang.org/t/why-cant-we-resize-a-reinterpreted-matrix/84780)._
