todense() vs collect() (vs. Matrix())
pnkraemer opened this issue · comments
Currently, there is a todense()
function (that is mostly used for testing).
The more julia-esque implementation might be collect()
. One could also do Matrix()
, but at the moment, I think it is better to not do this because Matrix() would implement fallbacks for almost all operations we would like to do, and having fallback implementations makes it really difficult to write tests.
Kronecker.jl uses collect: https://michielstock.github.io/Kronecker.jl/stable/man/basic/.
They also implement Matrix
, vial collect
:
https://github.com/MichielStock/Kronecker.jl/blob/0106a9d44008006854221b6a7ef788a7101e51ca/src/base.jl#L412
Also, their collect
uses getindex
, which kind of makes sense; the standard collect
iterates over elements and adds them to a container. In our case I'd argue that that's not what is happening?
There is also full()
? https://discourse.julialang.org/t/sparse-to-dense-matrix/8380
Apparently full
is outdated: https://discourse.julialang.org/t/sparse-to-dense-matrix/8380/14 (I have also never seen it so far)