Uploaded image for project: 'Hama'
  1. Hama
  2. HAMA-782

The arguments of DoubleVector.slice(int, int) method will mislead the user

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.6.3
    • machine learning, math
    • None

    Description

      The current implementation of DoubleVector.slice(int, int) is ambiguous.
      Current description of this method is as follows:

      --------------------------------------------------------
      Slices this vector from index offset with the given length. So you end at the upper bound of (offset+length).
      --------------------------------------------------------

      If the given vector is vec = [0, 1, 2, 3, 4, 5, 6], and user uses vec.slice(2, 3) and hope to get [2, 3, 4]. However, it actually returns [2,3].

      This is because the actual implementation extract the elements start from 'offset' and end at 'length' (exclusive). The argument name will mislead the user.

      Attachments

        1. HAMA-782.patch
          4 kB
          Yexi Jiang
        2. HAMA-782.patch
          5 kB
          Yexi Jiang

        Activity

          People

            yxjiang Yexi Jiang
            yxjiang Yexi Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: