Skip to content

Commit

Permalink
Warn but continue if error buffer is too small
Browse files Browse the repository at this point in the history
  • Loading branch information
RomeoV committed Jul 17, 2024
1 parent 1d79426 commit a9f4e72
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ksvd_update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ end
function compute_E_Ω!(::ThreadedKSVDMethodPrecomp{true}, E_Ω_buf, E, Y, D, X, xₖ, ωₖ, k, timer=TimerOutput())
@timeit_debug timer "compute E_Ω" begin

if size(E_Ω_buf, 2) <= length(ωₖ)
@warn """
The preallocated error buffer is too small. Not all errors will be computed. This is probably because
`maybe_init_buffer!` has been called with a ratio_nonzero that's too small. Try setting it to `1`.
"""
ωₖ = ωₖ[1:size(E_Ω_buf, 2)]
end
E_Ω = @view E_Ω_buf[:, 1:length(ωₖ)]

@timeit_debug timer "copy" begin
Expand All @@ -152,6 +159,13 @@ end
function compute_E_Ω!(::ThreadedKSVDMethodPrecomp{false}, E_Ω_buf, E, Y, D, X, xₖ, ωₖ, k, timer=TimerOutput())
@timeit_debug timer "compute E_Ω" begin

if size(E_Ω_buf, 2) <= length(ωₖ)
@warn """
The preallocated error buffer is too small. Not all errors will be computed. This is probably because
`maybe_init_buffer!` has been called with a ratio_nonzero that's too small. Try setting it to `1`.
"""
ωₖ = ωₖ[1:size(E_Ω_buf, 2)]
end
E_Ω = @view E_Ω_buf[:, 1:length(ωₖ)]

##<BEGIN OPTIMIZED BLOCK>
Expand Down

0 comments on commit a9f4e72

Please sign in to comment.