Skip to content

Commit

Permalink
use memory requirement heuristic for branching
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarrasch committed Nov 11, 2019
1 parent 1b732ba commit fd10ea2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kronecker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ end
@inline function _kronmul!(y, B::Union{MatrixMap,UniformScalingMap}, X, At::Union{MatrixMap,UniformScalingMap}, T)
na, ma = size(At)
mb, nb = size(B)
if (nb + ma) * na < (ma + mb) * nb
if nb*ma < mb*na
mul!(reshape(y, (mb, ma)), B, convert(Matrix, X*At))
else
mul!(reshape(y, (mb, ma)), convert(Matrix, B*X), At isa MatrixMap ? At.lmap : At.λ)
Expand All @@ -136,7 +136,7 @@ Base.@propagate_inbounds function A_mul_B!(y::AbstractVector, L::KroneckerMap{T,
require_one_based_indexing(y)
@boundscheck check_dim_mul(y, L, x)
A, B = L.maps
X = reshape(x, (size(B, 2), size(A, 2)))
X = LinearMap(reshape(x, (size(B, 2), size(A, 2))); issymmetric=false, ishermitian=false, isposdef=false)
_kronmul!(y, B, X, transpose(A), T)
return y
end
Expand Down

0 comments on commit fd10ea2

Please sign in to comment.