Skip to content

Commit 6112b35

Browse files
committed
restore constprop
1 parent 8745fcc commit 6112b35

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/tensors/indexmanipulations.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,19 @@ If `copy=false`, `tdst` might share data with `tsrc` whenever possible. Otherwis
303303
304304
See also [`insertrightunit`](@ref) and [`removeunit`](@ref).
305305
"""
306-
function insertleftunit(t::AbstractTensorMap, i::Int=numind(t) + 1;
307-
copy::Bool=true, conj::Bool=false, dual::Bool=false)
306+
@constprop :aggressive function insertleftunit(t::AbstractTensorMap, i::Int=numind(t) + 1;
307+
copy::Bool=true, conj::Bool=false,
308+
dual::Bool=false)
308309
W = insertleftunit(space(t), i; conj, dual)
309310
tdst = similar(t, W)
310311
for (c, b) in blocks(t)
311312
copy!(block(tdst, c), b)
312313
end
313314
return tdst
314315
end
315-
function insertleftunit(t::TensorMap, i::Int=numind(t) + 1;
316-
copy::Bool=false, conj::Bool=false, dual::Bool=false)
316+
@constprop :aggressive function insertleftunit(t::TensorMap, i::Int=numind(t) + 1;
317+
copy::Bool=false, conj::Bool=false,
318+
dual::Bool=false)
317319
W = insertleftunit(space(t), i; conj, dual)
318320
return TensorMap{scalartype(t)}(copy ? Base.copy(t.data) : t.data, W)
319321
end
@@ -329,15 +331,17 @@ If `copy=false`, `tdst` might share data with `tsrc` whenever possible. Otherwis
329331
330332
See also [`insertleftunit`](@ref) and [`removeunit`](@ref).
331333
"""
332-
function insertrightunit(t::AbstractTensorMap, i::Int=numind(t); copy::Bool=true, kwargs...)
334+
@constprop :aggressive function insertrightunit(t::AbstractTensorMap, i::Int=numind(t);
335+
copy::Bool=true, kwargs...)
333336
W = insertrightunit(space(t), i; kwargs...)
334337
tdst = similar(t, W)
335338
for (c, b) in blocks(t)
336339
copy!(block(tdst, c), b)
337340
end
338341
return tdst
339342
end
340-
function insertrightunit(t::TensorMap, i::Int=numind(t); copy::Bool=false, kwargs...)
343+
@constprop :aggressive function insertrightunit(t::TensorMap, i::Int=numind(t);
344+
copy::Bool=false, kwargs...)
341345
W = insertrightunit(space(t), i; kwargs...)
342346
return TensorMap{scalartype(t)}(copy ? Base.copy(t.data) : t.data, W)
343347
end
@@ -352,11 +356,11 @@ If `copy=false`, `tdst` might share data with `tsrc` whenever possible. Otherwis
352356
353357
This operation undoes the work of [`insertunit`](@ref).
354358
"""
355-
function removeunit(t::TensorMap, i::Int; copy::Bool=false)
359+
@constprop :aggressive function removeunit(t::TensorMap, i::Int; copy::Bool=false)
356360
W = removeunit(space(t), i)
357361
return TensorMap{scalartype(t)}(copy ? Base.copy(t.data) : t.data, W)
358362
end
359-
function removeunit(t::AbstractTensorMap, i::Int; copy::Bool=true)
363+
@constprop :aggressive function removeunit(t::AbstractTensorMap, i::Int; copy::Bool=true)
360364
W = removeunit(space(t), i)
361365
tdst = similar(t, W)
362366
for (c, b) in blocks(t)

0 commit comments

Comments
 (0)