Skip to content

Commit 2c26316

Browse files
committed
Fix bug in one of the accmarray methods.
1 parent 33023b0 commit 2c26316

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/utils.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -527,31 +527,31 @@ end
527527
function accumarray(subs, val::Number, sz=(maximum(subs),))
528528
A = zeros(eltype(val), sz...)
529529
@inbounds for i = 1:numel(subs)
530-
A[subs[i]] += val[i]
530+
A[subs[i]] += val
531531
end
532532
A
533533
end
534534

535535
# --------------------------------------------------------------------------------------------------
536536
function tic()
537-
t0 = time_ns()
538-
task_local_storage(:TIMERS, (t0, get(task_local_storage(), :TIMERS, ())))
539-
return t0
537+
t0 = time_ns()
538+
task_local_storage(:TIMERS, (t0, get(task_local_storage(), :TIMERS, ())))
539+
return t0
540540
end
541541

542542
function _toq()
543-
t1 = time_ns()
544-
timers = get(task_local_storage(), :TIMERS, ())
545-
(timers === ()) && error("`toc()` without `tic()`")
546-
t0 = timers[1]::UInt64
547-
task_local_storage(:TIMERS, timers[2])
548-
(t1-t0)/1e9
543+
_ = time_ns()
544+
timers = get(task_local_storage(), :TIMERS, ())
545+
(timers === ()) && error("`toc()` without `tic()`")
546+
t0 = timers[1]::UInt64
547+
task_local_storage(:TIMERS, timers[2])
548+
(t1-t0)/1e9
549549
end
550550

551551
function toc(V=true)
552-
t = _toq()
553-
(V) && println("elapsed time: ", t, " seconds")
554-
return t
552+
t = _toq()
553+
(V) && println("elapsed time: ", t, " seconds")
554+
return t
555555
end
556556

557557
# --------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)