Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse vector/matrix: add fast implementation of find_next and find_prev (fixed) #23317

Merged
merged 12 commits into from
Jan 6, 2018

Commits on Aug 18, 2017

  1. Sparse vector/matrix: add fast implementation of find_next and find_prev

    Before this commit, find_next() will just use the default implementation
    of looping over each element. When find_next is called without a
    function filter as first argument, we *know* that semantics are to find
    elements x satisfying x != 0, so for sparse matrices/vectors, we may
    only loop over the stored elements.
    
    Some care must be taken for stored zero values; that's the reason for
    the indirection of _sparse_find_next (which only finds the next stored
    element) and the actual find_next (which does actual non-zero checks).
    tkluck committed Aug 18, 2017
    Configuration menu
    Copy the full SHA
    d45df8d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    14f443a View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2017

  1. _sparse_findnext/prev: fix indentation

    (Use git blame -w for finding the non-whitespace edits to
    this code.)
    tkluck committed Aug 19, 2017
    Configuration menu
    Copy the full SHA
    92558be View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b54020 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2017

  1. Configuration menu
    Copy the full SHA
    5dde4af View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    daee267 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2017

  1. Merge remote-tracking branch 'origin/master' into sparse-find-next

    This fixes a few merge conflicts resulting from other additions to
    the sparse codebase.
    tkluck committed Nov 3, 2017
    Configuration menu
    Copy the full SHA
    1ac4141 View commit details
    Browse the repository at this point in the history
  2. Optimized findnext() for sparse: update now that predicate needs to b…

    …e explicit
    
    Since we now need explicit predicates [1], this optimization only works
    if we know that the predicate is a function that is false for zero
    values. As suggested in that pull request, we could find out by calling
    `f(zero(eltype(array)))` and hoping that `f` is pure, but I like being
    a bit more conservative and only applying this optimization only to the
    case where we *know* `f` is equal to `!iszero`.
    
    For clarity, this commit also renames the helper method
    _sparse_findnext()  to _sparse_findnextnz(), because now that the
    predicate-less version doesn't exist anymore, the `nz` part isn't
    implicit anymore either.
    
    [1]: JuliaLang#23812
    tkluck committed Nov 3, 2017
    Configuration menu
    Copy the full SHA
    fe4b76e View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2017

  1. sparse findnext()/findprev(): remove code duplication

    Thanks to @Sacha0 for the suggestion!
    tkluck committed Nov 10, 2017
    Configuration menu
    Copy the full SHA
    132ff27 View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2017

  1. sparse findnext()/findprev(): better type stability for exotic index …

    …types
    
    This mostly means returning `zero(indtype(...))` instead of `0` in the
    not-found case.  In addition, this commit replaces a few `== 0` checks
    by `iszero()` to avoid unnecessary promotions. We could similarly
    replace `+ 1` by `+ one(...)` but that becomes cumbersome very quickly.
    tkluck committed Nov 14, 2017
    Configuration menu
    Copy the full SHA
    85bc773 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2018

  1. Configuration menu
    Copy the full SHA
    a33abbe View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2018

  1. Fix sparse findprev()/findnext() for sub2ind deprecation

    This is needed in response to JuliaLang#24715.
    tkluck committed Jan 6, 2018
    Configuration menu
    Copy the full SHA
    db62ae4 View commit details
    Browse the repository at this point in the history