Skip to content

Commit b8a3253

Browse files
committed
keep init in dim and deal with repercussions in src
1 parent 6065d25 commit b8a3253

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/spaces/gradedspace.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ Base.hash(V::GradedSpace, h::UInt) = hash(V.dual, hash(V.dims, h))
9292
field(::Type{<:GradedSpace}) =
9393
InnerProductStyle(::Type{<:GradedSpace}) = EuclideanInnerProduct()
9494
function dim(V::GradedSpace)
95-
return sum(dim(V, c) * dim(c) for c in sectors(V))
95+
T = promote_type(Int, real(sectorscalartype(sectortype(V))))
96+
return sum(dim(V, c) * dim(c) for c in sectors(V); init = zero(T))
9697
end
9798
function dim(V::GradedSpace{I, <:AbstractDict}, c::I) where {I <: Sector}
9899
return get(V.dims, isdual(V) ? dual(c) : c, 0)

src/tensors/abstracttensor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ function Base.convert(::Type{Array}, t::AbstractTensorMap)
617617
dom = domain(t)
618618
T = sectorscalartype(I) <: Complex ? complex(scalartype(t)) :
619619
sectorscalartype(I) <: Integer ? scalartype(t) : float(scalartype(t))
620-
A = zeros(T, dims(t)...)
620+
A = zeros(T, Int.(dims(t))...)
621621
for (f₁, f₂) in fusiontrees(t)
622622
F = convert(Array, (f₁, f₂))
623623
Aslice = StridedView(A)[axes(cod, f₁.uncoupled)..., axes(dom, f₂.uncoupled)...]

src/tensors/tensor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function TensorMap(
333333
# dimension check
334334
codom = codomain(V)
335335
dom = domain(V)
336-
arraysize = dims(V)
336+
arraysize = Int.(dims(V))
337337
matsize = (dim(codom), dim(dom))
338338

339339
if !(size(data) == arraysize || size(data) == matsize)

0 commit comments

Comments
 (0)