Skip to content

Commit f68b679

Browse files
authored
Static vector in Tensorizer next (#316)
* sizedvector in tensorizer next * use svector
1 parent ec2496e commit f68b679

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Multivariate/TensorSpace.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function start(a::TrivialTensorizer{d}) where {d}
3838
return invoke(start, Tuple{Tensorizer2D}, a)
3939
else
4040
# ((block_dim_1, block_dim_2,...), (itaration_number, iterator, iterator_state)), (itemssofar, length)
41-
return (ones(Int, d),(0, nothing, nothing)), (0,length(a))
41+
block = SVector{d}(Ones{Int}(d))
42+
return (block, (0, nothing, nothing)), (0,length(a))
4243
end
4344
end
4445

@@ -72,8 +73,9 @@ function next(a::TrivialTensorizer{d}, iterator_tuple) where {d}
7273
end
7374

7475
# increase block, or initialize new block
75-
res, iter_state = iterate(iterator, iter_state)
76-
block .= res.+1
76+
_res, iter_state = iterate(iterator, iter_state)
77+
res = SVector{d}(_res)
78+
block = res.+1
7779
j = j+1
7880

7981
ret, ((block, (j, iterator, iter_state)), (i,tot))

0 commit comments

Comments
 (0)