You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loading ITensors before StaticArrays breaks basic StaticArrays constructors, such as @MVector zeros(2) and @MVector zeros(Int, 2).
Minimal code demonstrating the bug or unexpected behavior
Minimal runnable code
julia>using ITensors
julia>using StaticArrays
julia>@SVectorzeros(2)
2-element SVector{2, Float64} with indices SOneTo(2):0.00.0
julia>@SVectorzeros(Int, 2)
2-element SVector{2, Int64} with indices SOneTo(2):00
julia>@MVectorzeros(2)
ERROR: The size of type `MVector{N, 2} where N` is not known.
If you were trying to construct (or `convert` to) a `StaticArray` you
may need to add the size explicitly as a type parameter so its size is
inferrable to the Julia compiler (or performance would be terrible). For
example, you might try
m =zeros(3,3)
SMatrix(m) # this errorSMatrix{3,3}(m) # correct - size is inferrableSArray{Tuple{3,3}}(m) # correct, note Tuple{3,3}
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] missing_size_error(#unused#::Type{MVector{N, 2} where N})
@ StaticArrays ~/.julia/packages/StaticArrays/6D1fn/src/traits.jl:73
[3] Size(#unused#::Type{MVector{N, 2} where N})
@ StaticArrays ~/.julia/packages/StaticArrays/6D1fn/src/traits.jl:90
[4] zeros(#unused#::Type{MVector{N, 2} where N})
@ StaticArrays ~/.julia/packages/StaticArrays/6D1fn/src/arraymath.jl:1
[5] top-level scope
@ REPL[5]:1
julia>@MVectorzeros(Int, 2)
ERROR: TypeError:in Type, in parameter, expected Type, got a value of type Tuple{DataType}
Stacktrace:
[1] Size(s::Type{Tuple{Int64}})
@ StaticArrays ~/.julia/packages/StaticArrays/6D1fn/src/traits.jl:68
[2] Size
@ ~/.julia/packages/StaticArrays/6D1fn/src/traits.jl:90 [inlined]
[3] zeros(#unused#::Type{MVector{Int64, 2}})
@ StaticArrays ~/.julia/packages/StaticArrays/6D1fn/src/arraymath.jl:1
[4] top-level scope
@ REPL[6]:1
julia>versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-0612:58 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU:Intel(R) Xeon(R) E-2176M CPU @ 2.70GHz
WORD_SIZE:64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = vim
julia>using Pkg
julia> Pkg.status("StaticArrays")
Status `~/Dropbox (Simons Foundation)/workdir/StaticArrays.jl/Project.toml`
[90137ffa] StaticArrays v1.4.6
julia> Pkg.status("ITensors")
Status `~/Dropbox (Simons Foundation)/workdir/StaticArrays.jl/Project.toml`
[9136182c] ITensors v0.3.16
This works fine if I don't load ITensors first:
Minimal runnable code
julia>using StaticArrays
julia>@SVectorzeros(2)
2-element SVector{2, Float64} with indices SOneTo(2):0.00.0
julia>@SVectorzeros(Int, 2)
2-element SVector{2, Int64} with indices SOneTo(2):00
julia>@MVectorzeros(2)
2-element MVector{2, Float64} with indices SOneTo(2):0.00.0
julia>@MVectorzeros(Int, 2)
2-element MVector{2, Int64} with indices SOneTo(2):00
julia>versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-0612:58 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU:Intel(R) Xeon(R) E-2176M CPU @ 2.70GHz
WORD_SIZE:64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = vim
julia>using Pkg
julia> Pkg.status("StaticArrays")
Status `~/Dropbox (Simons Foundation)/workdir/StaticArrays.jl/Project.toml`
[90137ffa] StaticArrays v1.4.6
This is quite concerning behavior! This was caught because @MVector zeros(Int, 2) is being used in a line in the automatic fermion code and was causing test failures. @emstoudenmire
The text was updated successfully, but these errors were encountered:
Looks like this is fixed in StaticArrays 1.5.1 by JuliaArrays/StaticArrays.jl#1051. Need to add a lower bound on the compat entry and add a test for it.
Description of bug
Loading
ITensors
beforeStaticArrays
breaks basic StaticArrays constructors, such as@MVector zeros(2)
and@MVector zeros(Int, 2)
.Minimal code demonstrating the bug or unexpected behavior
Minimal runnable code
This works fine if I don't load
ITensors
first:Minimal runnable code
This is quite concerning behavior! This was caught because
@MVector zeros(Int, 2)
is being used in a line in the automatic fermion code and was causing test failures. @emstoudenmireThe text was updated successfully, but these errors were encountered: