Skip to content

Commit

Permalink
Try (unsuccessfully) to avoid allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbates committed Nov 15, 2017
1 parent f2608d1 commit c05ab2d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/linalg/lambdaprods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ function A_mul_Λ!(A::Matrix{T}, B::VectorFactorReTerm{T,V,R,S}) where {T,V,R,S}
m, n = size(A)
q, r = divrem(n, S)
iszero(r) || throw(DimensionMismatch("size(A, 2) = $n is not a multiple of S = $S"))
inds = 1:S
for blk in 1:q
## another place where ~ 1GB is allocated in d3 fit
A_mul_B!(view(A, :, inds), λ)
inds += S
A3 = reshape(A, (m, S, q))
for k in 1:q
A_mul_B!(view(A3, :, :, k), λ)
end
A
end
Expand Down

0 comments on commit c05ab2d

Please sign in to comment.