You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Dmitriy Lyubimov <dl...@gmail.com> on 2013/07/30 00:49:45 UTC

optimized times() for sparse matrices?

It has just occurred to me that neither of SparseMatrix, SparseRowMatrix
and SparseColMatrices have an optimized times() version.

Not sure why is that? Is it inherently hard/ not worth it/...? There should
be something to do that better than AbstractMatrix$times(), right?

Re: optimized times() for sparse matrices?

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
ok.

it looks like even generic views do not have assigned cost (e.g. column
view in a dense matrix ), which probably will make it difficult to expect
good stuff happening in some cases :

MatrixVectorView.java

  @Override
  public double getLookupCost() {
    // TODO: what is a genuine value here?
    return 1;
  }

  @Override
  public double getIteratorAdvanceCost() {
    // TODO: what is a genuine value here?
    return 1;
  }

  @Override
  public boolean isAddConstantTime() {
    // TODO: what is a genuine value here?
    return true;
  }

I guess Robin and Dan might want to chime in here, what the state of things
is here today. Are there any plans to finish this?


On Mon, Jul 29, 2013 at 5:01 PM, Ted Dunning <te...@gmail.com> wrote:

> Yes.  There should definitely be optimization here.  Much of this
> optimization could easily leverage the vector optimizations.
>
> There is also the question of what kind of matrix should be returned.
>
> A'B can be particularly effectively optimized in our common representations
> because we commonly use row major storage.
>
>
> On Mon, Jul 29, 2013 at 3:49 PM, Dmitriy Lyubimov <dl...@gmail.com>
> wrote:
>
> > It has just occurred to me that neither of SparseMatrix, SparseRowMatrix
> > and SparseColMatrices have an optimized times() version.
> >
> > Not sure why is that? Is it inherently hard/ not worth it/...? There
> should
> > be something to do that better than AbstractMatrix$times(), right?
> >
>

Re: optimized times() for sparse matrices?

Posted by Ted Dunning <te...@gmail.com>.
Yes.  There should definitely be optimization here.  Much of this
optimization could easily leverage the vector optimizations.

There is also the question of what kind of matrix should be returned.

A'B can be particularly effectively optimized in our common representations
because we commonly use row major storage.


On Mon, Jul 29, 2013 at 3:49 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:

> It has just occurred to me that neither of SparseMatrix, SparseRowMatrix
> and SparseColMatrices have an optimized times() version.
>
> Not sure why is that? Is it inherently hard/ not worth it/...? There should
> be something to do that better than AbstractMatrix$times(), right?
>