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/11 01:50:29 UTC

left/right diagonal matrix multiply not optimized?

Hello,
it looks like DiagonalMatrix does not do anything special about
multiplication (left or right). Seems like a waste (especially if diagonal
is a sparse vector).

Would it make sense to add an optimized multiplication?

Re: left/right diagonal matrix multiply not optimized?

Posted by Ted Dunning <te...@gmail.com>.
Cool.


On Wed, Jul 10, 2013 at 5:51 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:

> yes, i need this
> ok already got it added, will file a jira fo review of the patch
>
> -d
>
>
> On Wed, Jul 10, 2013 at 5:44 PM, Ted Dunning <te...@gmail.com>
> wrote:
>
> > Yes.  It definitely would make sense (if people do this).
> >
> > I can see that if multiplication by a diagonal matrix is optimized that
> > this would be a very nice way to express row (left multiplication) or
> > column (right multiplication) scaling or weighting.  The only down-side
> of
> > this approach is that a new matrix is instantiated for the result.  If
> you
> > want that, then you are good.  If you don't, then fancy use of assign is
> > better.
> >
> >
> >
> > On Wed, Jul 10, 2013 at 4:50 PM, Dmitriy Lyubimov <dl...@gmail.com>
> > wrote:
> >
> > > Hello,
> > > it looks like DiagonalMatrix does not do anything special about
> > > multiplication (left or right). Seems like a waste (especially if
> > diagonal
> > > is a sparse vector).
> > >
> > > Would it make sense to add an optimized multiplication?
> > >
> >
>

Re: left/right diagonal matrix multiply not optimized?

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
yes, i need this
ok already got it added, will file a jira fo review of the patch

-d


On Wed, Jul 10, 2013 at 5:44 PM, Ted Dunning <te...@gmail.com> wrote:

> Yes.  It definitely would make sense (if people do this).
>
> I can see that if multiplication by a diagonal matrix is optimized that
> this would be a very nice way to express row (left multiplication) or
> column (right multiplication) scaling or weighting.  The only down-side of
> this approach is that a new matrix is instantiated for the result.  If you
> want that, then you are good.  If you don't, then fancy use of assign is
> better.
>
>
>
> On Wed, Jul 10, 2013 at 4:50 PM, Dmitriy Lyubimov <dl...@gmail.com>
> wrote:
>
> > Hello,
> > it looks like DiagonalMatrix does not do anything special about
> > multiplication (left or right). Seems like a waste (especially if
> diagonal
> > is a sparse vector).
> >
> > Would it make sense to add an optimized multiplication?
> >
>

Re: left/right diagonal matrix multiply not optimized?

Posted by Ted Dunning <te...@gmail.com>.
Yes.  It definitely would make sense (if people do this).

I can see that if multiplication by a diagonal matrix is optimized that
this would be a very nice way to express row (left multiplication) or
column (right multiplication) scaling or weighting.  The only down-side of
this approach is that a new matrix is instantiated for the result.  If you
want that, then you are good.  If you don't, then fancy use of assign is
better.



On Wed, Jul 10, 2013 at 4:50 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:

> Hello,
> it looks like DiagonalMatrix does not do anything special about
> multiplication (left or right). Seems like a waste (especially if diagonal
> is a sparse vector).
>
> Would it make sense to add an optimized multiplication?
>