Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vec(::Array) may cease to share memory with parent once resized #49149

Open
jishnub opened this issue Mar 25, 2023 · 0 comments
Open

vec(::Array) may cease to share memory with parent once resized #49149

jishnub opened this issue Mar 25, 2023 · 0 comments
Labels
arrays [a, r, r, a, y, s]

Comments

@jishnub
Copy link
Contributor

jishnub commented Mar 25, 2023

julia> m = ones(2,2)
2×2 Matrix{Float64}:
 1.0  1.0
 1.0  1.0

julia> w = vec(m)
4-element Vector{Float64}:
 1.0
 1.0
 1.0
 1.0

julia> v = resize!(w, 6);

julia> v .= 0;

julia> w
6-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0

julia> m
2×2 Matrix{Float64}:
 1.0  1.0
 1.0  1.0

julia> versioninfo()
Julia Version 1.10.0-DEV.883
Commit 16e9f18833f (2023-03-25 03:47 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake)
  Threads: 1 on 8 virtual cores
Environment:
  LD_LIBRARY_PATH = :/usr/lib/x86_64-linux-gnu/gtk-3.0/modules
  JULIA_EDITOR = subl

Perhaps this should simply throw an error, instead of getting detached from the underlying matrix?

@jishnub jishnub added the arrays [a, r, r, a, y, s] label Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s]
Projects
None yet
Development

No branches or pull requests

1 participant