Uploaded image for project: 'Mahout'
  1. Mahout
  2. MAHOUT-1630

Incorrect SparseColumnMatrix.numSlices() causes IndexException in toString()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9
    • 0.10.0
    • classic

    Description

      SparseColumnMatrix overrides the numSlices() method incorrectly: it returns numCols() instead of numRows().
      As a result, AbstractMaxtrix.toString() for wide matrices throws an exception.
      For example, this code:

      Matrix matrix = new SparseColumnMatrix(1, 2);
      matrix.toString();

      causes

      org.apache.mahout.math.IndexException: Index 1 is outside allowable range of [0,1)
      at org.apache.mahout.math.MatrixVectorView.<init>(MatrixVectorView.java:42)
      at org.apache.mahout.math.AbstractMatrix.viewRow(AbstractMatrix.java:290)
      at org.apache.mahout.math.AbstractMatrix$1.computeNext(AbstractMatrix.java:68)
      at org.apache.mahout.math.AbstractMatrix$1.computeNext(AbstractMatrix.java:59)
      at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      at org.apache.mahout.math.AbstractMatrix.toString(AbstractMatrix.java:787)

      Attachments

        Activity

          People

            smarthi Suneel Marthi
            olegnitz Oleg Nitz
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: