You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does anyone know a non-allocating way to create a unit-stripped view into a SparseMatrixCSC? Let's assume I have the following sparse array:
A = (sprand(3, 3, 0.5))u"1/s"
Now if I want to use ustrip directly on that matrix, it'll default to ustrip.(A), which will allocate memory (which we want to avoid). A workaround could be using a reinterpretation of A, as it is done in the ustrip() implementation for the Matrix type:
reinterpret(Unitful.numtype(eltype(A)), A)
ERROR:`reinterpret` on sparse arrays is discontinued.
Try reinterpreting the value itself instead.
Hello :-)
Does anyone know a non-allocating way to create a unit-stripped view into a
SparseMatrixCSC
? Let's assume I have the following sparse array:Now if I want to use
ustrip
directly on that matrix, it'll default toustrip.(A)
, which will allocate memory (which we want to avoid). A workaround could be using a reinterpretation ofA
, as it is done in theustrip()
implementation for theMatrix
type::-(
Now let's assume we have the following idea:
The problem here is that
Base.ReinterpretArray
is not aVector
, which is required by theSparseMatrixCSC
type. And now I'm out of ideas ;-)Does anyone else have an idea how we can have unit-stripped views into sparse matrices which can then be used for efficient linear algebra?
The text was updated successfully, but these errors were encountered: