Skip to content

Commit 881a7c6

Browse files
authored
Merge pull request #17 from tinatorabi/main
fixed issue sparsevec
2 parents f6a0552 + fc9a4d8 commit 881a7c6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/BPDual.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,16 @@ function bpdual(
370370
if traceFlag
371371
push!(tracer.iteration, itn)
372372
push!(tracer.lambda, λ)
373-
sparse_x_full = SparseVector(n, copy(active), copy(x))
373+
sparse_x_full = spzeros(n)
374+
sparse_x_full[copy(active)] = copy(x)
374375
push!(tracer.solution, copy(sparse_x_full))
375376
end
376377
end
377378

378379
push!(tracer.iteration, itn)
379380
push!(tracer.lambda, λ)
380-
sparse_x_full = SparseVector(n, copy(active), copy(x))
381+
sparse_x_full = spzeros(n)
382+
sparse_x_full[copy(active)] = copy(x)
381383
push!(tracer.solution, copy(sparse_x_full))
382384

383385
tottime = time() - time0
@@ -388,4 +390,4 @@ function bpdual(
388390
@info "Solution time (sec): $tottime"
389391
end
390392
return tracer
391-
end
393+
end

0 commit comments

Comments
 (0)