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
There are interbal arrays that would be more efficient for access to the non-zero values in a SparseMatrix. Somtheing alaong the lines of:
let last = coMatrix.InternalSparseRowOffsets.Length - 1
if item >= 0 && item <= last then
let (startI, endI) =
if item = last then (coMatrix.InternalSparseRowOffsets.[item], coMatrix.InternalSparseRowOffsets.[item])
else (coMatrix.InternalSparseRowOffsets.[item], coMatrix.InternalSparseRowOffsets.[item + 1] - 1)
seq {
for idx = startI to endI do
let item= coMatrix.InternalSparseColumnValues.[idx]
yield KeyValuePair(coMatrix.InternalSparseValues.[idx], item)
}
It seems the only alternative is to iterate over a Row.
The element-wise operations would allow for more efficient code.
The text was updated successfully, but these errors were encountered:
Use matrix.IndexedEnumerator() to enumerate only over non-zero values - although there is currently no special IndexedColumnEnumerator(columnIndex) available. This could actually be implemented quite easily on our side, also for sparse matrices.
Access the compressed row storage directly, by casting matrix.Storage to SparseCompressedRowMatrixStorage<T> (possible since v2.2.1)
There are interbal arrays that would be more efficient for access to the non-zero values in a SparseMatrix. Somtheing alaong the lines of:
let last = coMatrix.InternalSparseRowOffsets.Length - 1
if item >= 0 && item <= last then
let (startI, endI) =
if item = last then (coMatrix.InternalSparseRowOffsets.[item], coMatrix.InternalSparseRowOffsets.[item])
else (coMatrix.InternalSparseRowOffsets.[item], coMatrix.InternalSparseRowOffsets.[item + 1] - 1)
seq {
for idx = startI to endI do
let item= coMatrix.InternalSparseColumnValues.[idx]
yield KeyValuePair(coMatrix.InternalSparseValues.[idx], item)
}
It seems the only alternative is to iterate over a Row.
The element-wise operations would allow for more efficient code.
The text was updated successfully, but these errors were encountered: