Skip to content

Commit

Permalink
fix addrow!+ test (#27)
Browse files Browse the repository at this point in the history
* unrestrict type of matrix elements

* fix addrow!'

* more test

* bump version
  • Loading branch information
guimarqu authored Oct 6, 2021
1 parent 12f1d92 commit db80549
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DynamicSparseArrays"
uuid = "8086fd22-9a0c-46a5-a6c8-6e24676501fe"
authors = ["Guillaume Marques <[email protected]>"]
version = "0.5.0"
version = "0.5.1"

[compat]
julia = "1"
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function addrow!(
addrow!(matrix.buffer, row, colids, vals)
else
for j in 1:length(colids)
setindex!(matrix, row, colids[j], vals[j])
setindex!(matrix, vals[j], row, colids[j])
end
end
return true
Expand Down
10 changes: 10 additions & 0 deletions test/functional/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,16 @@ function dynsparsematrix_fill_mode()
@test matrix.rowmajor[j, i] == values[i, j]
end

# Try addrow! when fill mode off
row_id = 7
row_cols = [1, 3, 4, 5]
row_vals = [2, 3, 6, 7]
addrow!(matrix, row_id, row_cols, row_vals)

for (k,j) in enumerate(row_cols)
@test matrix[row_id,j] == row_vals[k]
end

## Second test
row = rand(rng, 1:1000, 10_000)
col = rand(rng, 1:1000, 10_000)
Expand Down

2 comments on commit db80549

@guimarqu
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/46222

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.1 -m "<description of version>" db8054954f1815657a636a93185e72d6925a6f3a
git push origin v0.5.1

Please sign in to comment.