I am finding it awkward to write code that works with both dense and sparse arrays because the APIs differ in subtle ways. Two quick examples:
zeros
or spzeros
instead of something like zero(Vector{Int}, n)
and zero(SparseVector{Int}, n)
.findnz
for sparse arrays but not dense onesDo I just have put up with it and write the helper functions, or are there better options?
Evan Patterson said:
I am finding it awkward to write code that works with both dense and sparse arrays because the APIs differ in subtle ways. Do I just have to ... write the helper functions, or are there better options?
afaik Writing the smoothing, soothing, API unifying helpers that matter most and keeping them brief an in one place and not so many as to be hard to undo as the actual API s converge (one hopes and expects) while providing the specifics to JuliaArrays as separably approachable issues would be the second best option. Best would be a good clean solution through someone on discourse who has done it.
Also the #arrays channel on Slack (I added you, you can remove you as you please) has people who know more than I about this.
Thanks, I may also ask there. It's not too big a deal, but I bet I'm not the first or the last person to encounter this situation.
Last updated: Nov 22 2024 at 04:41 UTC