Skip to content

Commit 86fbdeb

Browse files
authored
Remove unsafeviews from LazyTensors (#187)
1 parent 12765d5 commit 86fbdeb

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "QuantumOpticsBase"
22
uuid = "4f57444f-1401-5e15-980d-4471b28d5678"
3-
version = "0.5.4"
3+
version = "0.5.5"
44

55
[deps]
66
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/operators_lazytensor.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,9 @@ function _tp_matmul_first!(result, a::AbstractMatrix, b, α::Number, β::Number)
282282
d_rest = length(b)÷d_first
283283
bp = parent(b)
284284
rp = parent(result)
285-
@uviews bp rp begin # avoid allocations on reshape
286-
br = reshape(bp, (d_first, d_rest))
287-
result_r = reshape(rp, (size(a, 1), d_rest))
288-
mul!(result_r, a, br, α, β)
289-
end
285+
@views br = reshape(bp, (d_first, d_rest))
286+
@views result_r = reshape(rp, (size(a, 1), d_rest))
287+
mul!(result_r, a, br, α, β)
290288
result
291289
end
292290

@@ -295,11 +293,9 @@ function _tp_matmul_last!(result, a::AbstractMatrix, b, α::Number, β::Number)
295293
d_rest = length(b)÷d_last
296294
bp = parent(b)
297295
rp = parent(result)
298-
@uviews a bp rp begin # avoid allocations on reshape
299-
br = reshape(bp, (d_rest, d_last))
300-
result_r = reshape(rp, (d_rest, size(a, 1)))
301-
mul!(result_r, br, transpose(a), α, β)
302-
end
296+
@views br = reshape(bp, (d_rest, d_last))
297+
@views result_r = reshape(rp, (d_rest, size(a, 1)))
298+
mul!(result_r, br, transpose(a), α, β)
303299
result
304300
end
305301

0 commit comments

Comments
 (0)