Skip to content

Commit

Permalink
Merge pull request #8 from timholy/dense-valspec
Browse files Browse the repository at this point in the history
Return dense valspec in sparse_factors
  • Loading branch information
timholy committed Jan 21, 2016
2 parents 02e7067 + e939186 commit 5cc1eb4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/WoodburyMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,16 @@ function sparse_factors{T}(::Type{T}, n::Int, args::@compat(Tuple{Int, Int, Any}
m = length(args)
rows = spzeros(T, n, m)
cols = spzeros(T, m, n)
val_diag = zeros(m)
vals = zeros(T, m, m)

ix = 1
for (i, (row, col, val)) in enumerate(args)
rows[row, ix] = 1
cols[ix, col] = 1
val_diag[ix] = val
vals[ix, ix] = val
ix += 1
end

vals = spdiagm(val_diag)

rows, vals, cols
end

Expand Down

0 comments on commit 5cc1eb4

Please sign in to comment.