Timeline for Best way to extend the size and add terms to a SparseArray without expanding
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 16 at 18:56 | comment | added | Henrik Schumacher | Note that this way duplicate entries will be merged such that the first occurence is taken. (In particular, no additive assembly.) | |
Aug 16 at 15:19 | comment | added | Henrik Schumacher |
Do you like SparseArray[ Join[{{i_, i_} -> 1, {3, 4} -> b}, ArrayRules[m2]] ] better? The rules are processed FIFO, so this might be what you are looking for.
|
|
Aug 16 at 15:18 | comment | added | Henrik Schumacher |
Hm. The problem with rules is that this would require to unpack the CRS data from the SparseArray . If the rules don't index into the existing matrix, then this unpacking is not really needed.
|
|
Aug 16 at 15:09 | history | edited | Henrik Schumacher | CC BY-SA 4.0 |
added 1239 characters in body
|
Aug 16 at 15:04 | comment | added | rhermans |
I was expecting something like extendSparseArray[sparseaarray_, rules_] , two arguments, a SparseArray and a list of rules. With your approach if I try to extend with something like {i_,i_-1} -> 2 , I will need to put that rule in three sub-matrices.
|
|
Aug 16 at 14:07 | history | edited | Henrik Schumacher | CC BY-SA 4.0 |
added 1239 characters in body
|
Aug 16 at 14:00 | history | edited | Henrik Schumacher | CC BY-SA 4.0 |
added 1239 characters in body
|
Aug 16 at 13:44 | history | answered | Henrik Schumacher | CC BY-SA 4.0 |