You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Jake Mannix <ja...@gmail.com> on 2012/03/21 23:32:26 UTC

MatrixVectorView Considered Harmful

Can anyone tell me what the following implementation choice will cause:

public class MatrixVectorView extends AbstractVector {

  //...

  public Iterator<Element> iterateNonZero() {
    return iterator();
  }

  // ...

}

Note that MatrixVectorView is returned from every call to viewRow(), and
getRow() was removed in the last release.

-- 

  -jake

Re: MatrixVectorView Considered Harmful

Posted by Ted Dunning <te...@gmail.com>.
This causes implementations that don't over-ride that method to lose the
benefits of sparsity when iterating through rows.

I deduce from the existence of your email that important sparse matrix
implementations suffer from this defect.

On Wed, Mar 21, 2012 at 10:32 PM, Jake Mannix <ja...@gmail.com> wrote:

> Can anyone tell me what the following implementation choice will cause:
>
> public class MatrixVectorView extends AbstractVector {
>
>  //...
>
>  public Iterator<Element> iterateNonZero() {
>    return iterator();
>  }
>
>  // ...
>
> }
>
> Note that MatrixVectorView is returned from every call to viewRow(), and
> getRow() was removed in the last release.
>
> --
>
>  -jake
>