You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Ceyhun Can Ülker (JIRA)" <ji...@apache.org> on 2013/02/03 21:44:12 UTC

[jira] [Created] (MAHOUT-1146) Cardinality exception bug in 'cross' method of AbstractVector class.

Ceyhun Can Ülker created MAHOUT-1146:
----------------------------------------

             Summary: Cardinality exception bug in 'cross' method of AbstractVector class.
                 Key: MAHOUT-1146
                 URL: https://issues.apache.org/jira/browse/MAHOUT-1146
             Project: Mahout
          Issue Type: Bug
          Components: Math
    Affects Versions: 0.8
         Environment: Ubuntu 12.10 64-bit
            Reporter: Ceyhun Can Ülker
            Priority: Critical


This bug is probably about the viewColumn method, or matrixLike method or MatrixVectorView constructor, I didn't really looked into it. But it is easy to reproduce.

I have a dense matrix U of size 10x670. When I try to do this I get a cardinality exception, which doesn't make sense:

Vector uI = U.viewColumn(i);
Matrix outerProduct = uI.cross(uI);

Exception is thrown from AbstractMatrix class' cross method, when a row is tried to be assigned in the result matrix.
  public Matrix cross(Vector other) {
    Matrix result = matrixLike(size, other.size());
    for (int row = 0; row < size; row++) {
      result.assignRow(row, other.times(getQuick(row)));
    }
    return result;
  }

The problem here is matrixLike method does not return a 10x10 matrix as it should, instead it returns 1x1 matrix. 

Hope this helps.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira