From 482aca2aeb6fcf5cc90811821c3e20252c8c6fea Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Thu, 31 Dec 2015 08:37:47 +0200 Subject: [PATCH] sparse rhs: calculate several right hand sides at once --- src/sparse.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sparse.jl b/src/sparse.jl index 2ed65f8..1fd87ba 100644 --- a/src/sparse.jl +++ b/src/sparse.jl @@ -108,14 +108,14 @@ function add!(A::SparseMatrixIJV, dofs1::Vector{Int}, dofs2::Vector{Int}, data:: end """ Add new data to COO Sparse vector. """ -function add!(A::SparseMatrixCOO, dofs::Vector{Int}, data::Array{Float64}) +function add!(A::SparseMatrixCOO, dofs::Vector{Int}, data::Array{Float64}, dim::Int=1) if length(dofs) != length(data) info("dofs = $dofs") info("data = $(vec(data))") error("when adding to sparse vector dimension mismatch!") end append!(A.I, dofs) - append!(A.J, ones(Int, length(dofs))) + append!(A.J, dim*ones(Int, length(dofs))) append!(A.V, vec(data)) end