function _getValueIndex(i, top, bottom, index) {
    // check row is on the bottom side
    if (bottom - top === 0) {
      return bottom;
    } // loop rows [top, bottom[


    for (var r = top; r < bottom; r++) {
      // check we found value index
      if (index[r] === i) {
        return r;
      }
    } // we did not find row


    return top;
  }
Replace a single element in the matrix.
@memberof SparseMatrix
@param {number[]} index   Zero-based index
@param {*} v
@param {*} [defaultValue]        Default value, filled in on new entries when
                                 the matrix is resized. If not provided,
                                 new matrix elements will be set to zero.
@return {SparseMatrix} self