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 2011/12/25 22:37:58 UTC

outer product

Hello,

just stumbled on this in vector while looking for outer product operation --

  @Override
  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;
  }


It seems this guy computes an outer product, but not cross product (
crossprod for vectors =ab sin(theta)n). Seems like a misleading
naming.

It is probably motivated by R, where tcrossproduct (which is a product
of matrices, not vectors) is defined as XY' and crossprod which is
defined X'Y and so in case of cbind(vector) it would constitute either
dot product or outer product respectively. But i am not sure where R
is deriving this; and even then it is definitely misleading as R would
apply this to the world of matrices, not vectors. In vectors cross
product means something else and i think this may create a confusion
(it certainly did in my case)..

thanks.
-Dmitriy

Re: outer product

Posted by Raphael Cendrillon <ce...@gmail.com>.
On second look I see I was wrong. You're completely right, it should be outer product. 

On Dec 25, 2011, at 3:51 PM, Sean Owen <sr...@gmail.com> wrote:

> The cross product is the vector product, and is not the same thing as
> an outer product. To me it is simply misnamed. That's an outer product
> there. The cross/vector product results in a vector, not a matrix.
> 
> On Sun, Dec 25, 2011 at 5:39 PM, Raphael Cendrillon
> <ce...@gmail.com> wrote:
>> I think the cross product is typically used to refer to the outer product, while the dot product refers to the inner product.
>> 
>> On Dec 25, 2011, at 2:51 PM, Ted Dunning <te...@gmail.com> wrote:
>> 
>>> This is misleading even if not strictly incorrect.  In matrix terminology,
>>> outer product is definitely more commonly used.

Re: outer product

Posted by Sean Owen <sr...@gmail.com>.
The cross product is the vector product, and is not the same thing as
an outer product. To me it is simply misnamed. That's an outer product
there. The cross/vector product results in a vector, not a matrix.

On Sun, Dec 25, 2011 at 5:39 PM, Raphael Cendrillon
<ce...@gmail.com> wrote:
> I think the cross product is typically used to refer to the outer product, while the dot product refers to the inner product.
>
> On Dec 25, 2011, at 2:51 PM, Ted Dunning <te...@gmail.com> wrote:
>
>> This is misleading even if not strictly incorrect.  In matrix terminology,
>> outer product is definitely more commonly used.

Re: outer product

Posted by Ted Dunning <te...@gmail.com>.
Cross product can refer to the application of the multiplication operator
to each element of the Cartesian cross product of two sets.  When used this
way, it is the same as what would normally be called outer product.

But I completely agree with Dmitriy that more people are going to
understand the name "outer product" correctly than the name cross product.

On Sun, Dec 25, 2011 at 4:07 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:

> Wikipedia seems to disagree. I also knew it the same way as wikipedia
> states, before.
>
> http://en.wikipedia.org/wiki/Cross_product
>
>
>
> On Sun, Dec 25, 2011 at 3:39 PM, Raphael Cendrillon
> <ce...@gmail.com> wrote:
> > I think the cross product is typically used to refer to the outer
> product, while the dot product refers to the inner product.
> >
> > On Dec 25, 2011, at 2:51 PM, Ted Dunning <te...@gmail.com> wrote:
> >
> >> This is misleading even if not strictly incorrect.  In matrix
> terminology,
> >> outer product is definitely more commonly used.
> >>
> >> On Sun, Dec 25, 2011 at 1:37 PM, Dmitriy Lyubimov <dl...@gmail.com>
> wrote:
> >>
> >>> Hello,
> >>>
> >>> just stumbled on this in vector while looking for outer product
> operation
> >>> --
> >>>
> >>> @Override
> >>> 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;
> >>> }
> >>>
> >>>
> >>> It seems this guy computes an outer product, but not cross product (
> >>> crossprod for vectors =ab sin(theta)n). Seems like a misleading
> >>> naming.
> >>>
> >>> It is probably motivated by R, where tcrossproduct (which is a product
> >>> of matrices, not vectors) is defined as XY' and crossprod which is
> >>> defined X'Y and so in case of cbind(vector) it would constitute either
> >>> dot product or outer product respectively. But i am not sure where R
> >>> is deriving this; and even then it is definitely misleading as R would
> >>> apply this to the world of matrices, not vectors. In vectors cross
> >>> product means something else and i think this may create a confusion
> >>> (it certainly did in my case)..
> >>>
> >>> thanks.
> >>> -Dmitriy
> >>>
>

Re: outer product

Posted by Dmitriy Lyubimov <dl...@gmail.com>.
Wikipedia seems to disagree. I also knew it the same way as wikipedia
states, before.

http://en.wikipedia.org/wiki/Cross_product



On Sun, Dec 25, 2011 at 3:39 PM, Raphael Cendrillon
<ce...@gmail.com> wrote:
> I think the cross product is typically used to refer to the outer product, while the dot product refers to the inner product.
>
> On Dec 25, 2011, at 2:51 PM, Ted Dunning <te...@gmail.com> wrote:
>
>> This is misleading even if not strictly incorrect.  In matrix terminology,
>> outer product is definitely more commonly used.
>>
>> On Sun, Dec 25, 2011 at 1:37 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> just stumbled on this in vector while looking for outer product operation
>>> --
>>>
>>> @Override
>>> 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;
>>> }
>>>
>>>
>>> It seems this guy computes an outer product, but not cross product (
>>> crossprod for vectors =ab sin(theta)n). Seems like a misleading
>>> naming.
>>>
>>> It is probably motivated by R, where tcrossproduct (which is a product
>>> of matrices, not vectors) is defined as XY' and crossprod which is
>>> defined X'Y and so in case of cbind(vector) it would constitute either
>>> dot product or outer product respectively. But i am not sure where R
>>> is deriving this; and even then it is definitely misleading as R would
>>> apply this to the world of matrices, not vectors. In vectors cross
>>> product means something else and i think this may create a confusion
>>> (it certainly did in my case)..
>>>
>>> thanks.
>>> -Dmitriy
>>>

Re: outer product

Posted by Raphael Cendrillon <ce...@gmail.com>.
I think the cross product is typically used to refer to the outer product, while the dot product refers to the inner product. 

On Dec 25, 2011, at 2:51 PM, Ted Dunning <te...@gmail.com> wrote:

> This is misleading even if not strictly incorrect.  In matrix terminology,
> outer product is definitely more commonly used.
> 
> On Sun, Dec 25, 2011 at 1:37 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:
> 
>> Hello,
>> 
>> just stumbled on this in vector while looking for outer product operation
>> --
>> 
>> @Override
>> 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;
>> }
>> 
>> 
>> It seems this guy computes an outer product, but not cross product (
>> crossprod for vectors =ab sin(theta)n). Seems like a misleading
>> naming.
>> 
>> It is probably motivated by R, where tcrossproduct (which is a product
>> of matrices, not vectors) is defined as XY' and crossprod which is
>> defined X'Y and so in case of cbind(vector) it would constitute either
>> dot product or outer product respectively. But i am not sure where R
>> is deriving this; and even then it is definitely misleading as R would
>> apply this to the world of matrices, not vectors. In vectors cross
>> product means something else and i think this may create a confusion
>> (it certainly did in my case)..
>> 
>> thanks.
>> -Dmitriy
>> 

Re: outer product

Posted by Ted Dunning <te...@gmail.com>.
This is misleading even if not strictly incorrect.  In matrix terminology,
outer product is definitely more commonly used.

On Sun, Dec 25, 2011 at 1:37 PM, Dmitriy Lyubimov <dl...@gmail.com> wrote:

> Hello,
>
> just stumbled on this in vector while looking for outer product operation
> --
>
>  @Override
>  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;
>  }
>
>
> It seems this guy computes an outer product, but not cross product (
> crossprod for vectors =ab sin(theta)n). Seems like a misleading
> naming.
>
> It is probably motivated by R, where tcrossproduct (which is a product
> of matrices, not vectors) is defined as XY' and crossprod which is
> defined X'Y and so in case of cbind(vector) it would constitute either
> dot product or outer product respectively. But i am not sure where R
> is deriving this; and even then it is definitely misleading as R would
> apply this to the world of matrices, not vectors. In vectors cross
> product means something else and i think this may create a confusion
> (it certainly did in my case)..
>
> thanks.
> -Dmitriy
>