@ericphanson On the topic of type piracy: As far as I understand, type piracy should be fine in this case, even if other libraries use this function.Quoting Jeff Bezanos:
Right, type piracy is defining
function f(x::T)
where you “own” neitherf
norT
. Iff
is your own function, orT
is a type you defined, there’s no issue at all. But even if neither is true, it still might be OK. It’s just a smell that something bad might be happening, such as:
The author/designer off
really did not want it to support typeT
, so you’re misunderstanding what the function is supposed to mean.
The code is in the wrong place, and should be moved to wheref
orT
is defined.
But if everything seems to be in order, pirate away.
Of course in this case there might be many other packages using dense x sparse mul, but (let’s imagine for a second this to be true) my implementation is IEEE compliant, and that the threading is fine even e.g. inside of other threading, that I should be fine pirating the mul!
function. In fact, I believe other packages like MKLSparse.jl
do the same.
Happy to hear your thoughts, however.