-
Notifications
You must be signed in to change notification settings - Fork 58
add: [CartesianIndex...] sparse method #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
A method for specifying the indexes to fill with values directly as CartesianIndices.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #600 +/- ##
==========================================
+ Coverage 84.08% 84.11% +0.02%
==========================================
Files 12 12
Lines 9192 9195 +3
==========================================
+ Hits 7729 7734 +5
+ Misses 1463 1461 -2 ☔ View full report in Codecov by Sentry. |
Another method that should be considered are ones that are created by using a range on instances of julia> CartesianIndex(3,4):CartesianIndex(4,9)
CartesianIndices((3:4, 4:9))
julia> CartesianIndex(3,4):CartesianIndex(4,9) |> typeof |> supertypes
(CartesianIndices{2, Tuple{UnitRange{Int64}, UnitRange{Int64}}}, AbstractMatrix{CartesianIndex{2}}, Any) |
Note that the |
Perhaps what you are describing is a more realistic use of the dense block. That was what I had in mind although the julia> sparse(CartesianIndex(12:14):CartesianIndex(15:17), ones(3*3), 20, 20) + sparse(CartesianIndex(2:4):CartesianIndex(5:7), ones(3*3), 20, 20) Which would create a sparse matrix with dense blocks inside. The structure of the type does not give the best memory usage for this case... |
NOTE: `CartesianIndex{2}` is no longer an abstract type so the function no longer needs to be parametric.
A method for specifying the indexes to fill with values directly as
CartesianIndices.
For example:
is now possible.