diff --git a/src/tensors/indexmanipulations.jl b/src/tensors/indexmanipulations.jl index fa017f10..d90b2194 100644 --- a/src/tensors/indexmanipulations.jl +++ b/src/tensors/indexmanipulations.jl @@ -215,7 +215,7 @@ If `copy=false`, `tdst` might share data with `tsrc` whenever possible. Otherwis To repartition into an existing destination, see [repartition!](@ref). """ -function repartition(t::AbstractTensorMap, N₁::Int, N₂::Int=numind(t) - N₁; +Base.@constprop :aggressive function repartition(t::AbstractTensorMap, N₁::Int, N₂::Int=numind(t) - N₁; copy::Bool=false) N₁ + N₂ == numind(t) || throw(ArgumentError("Invalid repartition: $(numind(t)) to ($N₁, $N₂)")) diff --git a/test/tensors.jl b/test/tensors.jl index c884316d..eec55734 100644 --- a/test/tensors.jl +++ b/test/tensors.jl @@ -202,7 +202,7 @@ for V in spacelist @test dot(t2′, t2) ≈ dot(t′, t) ≈ dot(transpose(t2′), transpose(t2)) end - t3 = @constinferred repartition(t, k) + t3 = @constinferred repartition(t, $k) @test norm(t3) ≈ norm(t) t3′ = @constinferred repartition!(similar(t3), t′) @test norm(t3′) ≈ norm(t′)