@@ -401,7 +401,7 @@ for f in (:sqrt, :log, :asin, :acos, :acosh, :atanh, :acoth)
401401end
402402
403403# concatenate tensors
404- function catdomain (t1:: T , t2:: T ) where {S,N₁,T <: AbstractTensorMap{<:Any,S,N₁,1} }
404+ function catdomain (t1:: TT , t2:: TT ) where {S,N₁,TT <: AbstractTensorMap{<:Any,S,N₁,1} }
405405 codomain (t1) == codomain (t2) ||
406406 throw (SpaceMismatch (" codomains of tensors to concatenate must match:\n " *
407407 " $(codomain (t1)) ≠ $(codomain (t2)) " ))
@@ -411,14 +411,15 @@ function catdomain(t1::T, t2::T) where {S,N₁,T<:AbstractTensorMap{<:Any,S,N₁
411411 throw (SpaceMismatch (" cannot horizontally concatenate tensors whose domain has non-matching duality" ))
412412
413413 V = V1 ⊕ V2
414- t = TensorMap (undef, promote_type (scalartype (t1), scalartype (t2)), codomain (t1), V)
414+ T = promote_type (scalartype (t1), scalartype (t2))
415+ t = TensorMap {T} (undef, codomain (t1), V)
415416 for c in sectors (V)
416417 block (t, c)[:, 1 : dim (V1, c)] .= block (t1, c)
417418 block (t, c)[:, dim (V1, c) .+ (1 : dim (V2, c))] .= block (t2, c)
418419 end
419420 return t
420421end
421- function catcodomain (t1:: T , t2:: T ) where {S,N₂,T <: AbstractTensorMap{<:Any,S,1,N₂} }
422+ function catcodomain (t1:: TT , t2:: TT ) where {S,N₂,TT <: AbstractTensorMap{<:Any,S,1,N₂} }
422423 domain (t1) == domain (t2) ||
423424 throw (SpaceMismatch (" domains of tensors to concatenate must match:\n " *
424425 " $(domain (t1)) ≠ $(domain (t2)) " ))
@@ -428,7 +429,8 @@ function catcodomain(t1::T, t2::T) where {S,N₂,T<:AbstractTensorMap{<:Any,S,1,
428429 throw (SpaceMismatch (" cannot vertically concatenate tensors whose codomain has non-matching duality" ))
429430
430431 V = V1 ⊕ V2
431- t = TensorMap (undef, promote_type (scalartype (t1), scalartype (t2)), V, domain (t1))
432+ T = promote_type (scalartype (t1), scalartype (t2))
433+ t = TensorMap {T} (undef, V, domain (t1))
432434 for c in sectors (V)
433435 block (t, c)[1 : dim (V1, c), :] .= block (t1, c)
434436 block (t, c)[dim (V1, c) .+ (1 : dim (V2, c)), :] .= block (t2, c)
0 commit comments