-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sparse versions of repeat for matrices and vectors (#532)
* Move col_length offset to helper function The col_length function argument was pretty confusing, as it expected not the number of nonzero elements in the column, but rather one less than that. This moves this offset by one to the actual for-loop that it is for, which clarifies the meaning and also simplifies callsites. * Simplify arguments of helper functions Instead of taking the whole input matrix, only take the actuallly required parts (row indices and nonzero values). That allows using it in more contexts. * Add efficient repeat for sparse matrices * Add efficient repeat for sparse vectors * Avoid using temporary vars for sparse data arrays Just use the accessor functions rowvals, nonzeros, getcolptr whenever needed instead. Especially in the sparse vector case avoid using findnz, which creates a copy of the data. Use nonzeroinds and nonzeros instead. * Return next insert position from stuffcol helper Simplifies updating the insert position at the call site.
- Loading branch information
Showing
4 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters