You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by "ahmed.nagy" <ah...@hotmail.com> on 2011/01/21 00:55:39 UTC

Result of Matrix * Matrix Transpose

I have two matrices A and B both of them are distributed row matrices I want
to have the result of A * B' when I did that I got the values for A * B Any
ideas how to compute A * B ' ? 
That is a bit of my code  this gives the result of A * B 

A=
1.000 2.000 3.000
4.000 5.000 6.000
7.000 8.000 9.000
B'=


Result expected
 14.000  32.000  50.000
 32.000  77.000 122.000
 50.000 122.000 194.000

Result printed

The result of matrix AA'
30.0 36.0 42.0 
66.0 81.0 96.0 
102.0 126.0 150.0 

the result printed is basically A.A

Matrix_v_mult_v_transpose=(Matrix_v.times(Matrix_v.transpose()));
			System.out.println("The result of matrix AA'");
			printDistributedMatrix(Matrix_v_mult_v_transpose);

-----
Ahmed Nagy
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Result-of-Matrix-Matrix-Transpose-tp2296621p2296621.html
Sent from the Mahout User List mailing list archive at Nabble.com.

Re: Result of Matrix * Matrix Transpose

Posted by Song Liu <so...@gmail.com>.
> how to multiply to two matirces without explicitly transpose them.
it means u can get A*B, A'*B, A*B', and (A*B)' only with row based matrix A 
and B

--S

-----原始邮件----- 
From: Song Liu
Sent: Friday, January 21, 2011 11:02 PM
To: user@mahout.apache.org
Subject: Re: Result of Matrix * Matrix Transpose

Dear Ahmed,

    Sorry maybe this mail may not be directly related to your problem, but I
found this problem has been solved in my project BigO
(http://bigo2.googlecode.com), and if you are interested, in the latest
release, there is a example shows how to multiply to two matirces without
explicitly transpose them.

    Please check out the simple.sh file unde folder 'examples'

Best Wishes
Song Liu

-----原始邮件----- 
From: ahmed.nagy
Sent: Friday, January 21, 2011 8:55 AM
To: mahout-user@lucene.apache.org
Subject: Result of Matrix * Matrix Transpose


I have two matrices A and B both of them are distributed row matrices I want
to have the result of A * B' when I did that I got the values for A * B Any
ideas how to compute A * B ' ?
That is a bit of my code  this gives the result of A * B

A=
1.000 2.000 3.000
4.000 5.000 6.000
7.000 8.000 9.000
B'=


Result expected
14.000  32.000  50.000
32.000  77.000 122.000
50.000 122.000 194.000

Result printed

The result of matrix AA'
30.0 36.0 42.0
66.0 81.0 96.0
102.0 126.0 150.0

the result printed is basically A.A

Matrix_v_mult_v_transpose=(Matrix_v.times(Matrix_v.transpose()));
System.out.println("The result of matrix AA'");
printDistributedMatrix(Matrix_v_mult_v_transpose);

-----
Ahmed Nagy
-- 
View this message in context:
http://lucene.472066.n3.nabble.com/Result-of-Matrix-Matrix-Transpose-tp2296621p2296621.html
Sent from the Mahout User List mailing list archive at Nabble.com.


Re: Result of Matrix * Matrix Transpose

Posted by Song Liu <so...@gmail.com>.
Dear Ahmed,

    Sorry maybe this mail may not be directly related to your problem, but I 
found this problem has been solved in my project BigO 
(http://bigo2.googlecode.com), and if you are interested, in the latest 
release, there is a example shows how to multiply to two matirces without 
explicitly transpose them.

    Please check out the simple.sh file unde folder 'examples'

Best Wishes
Song Liu

-----原始邮件----- 
From: ahmed.nagy
Sent: Friday, January 21, 2011 8:55 AM
To: mahout-user@lucene.apache.org
Subject: Result of Matrix * Matrix Transpose


I have two matrices A and B both of them are distributed row matrices I want
to have the result of A * B' when I did that I got the values for A * B Any
ideas how to compute A * B ' ?
That is a bit of my code  this gives the result of A * B

A=
1.000 2.000 3.000
4.000 5.000 6.000
7.000 8.000 9.000
B'=


Result expected
14.000  32.000  50.000
32.000  77.000 122.000
50.000 122.000 194.000

Result printed

The result of matrix AA'
30.0 36.0 42.0
66.0 81.0 96.0
102.0 126.0 150.0

the result printed is basically A.A

Matrix_v_mult_v_transpose=(Matrix_v.times(Matrix_v.transpose()));
System.out.println("The result of matrix AA'");
printDistributedMatrix(Matrix_v_mult_v_transpose);

-----
Ahmed Nagy
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/Result-of-Matrix-Matrix-Transpose-tp2296621p2296621.html
Sent from the Mahout User List mailing list archive at Nabble.com. 


Re: Result of Matrix * Matrix Transpose

Posted by Ted Dunning <te...@gmail.com>.
What type are these matrices.

If they are any in-memory matrix, this should be correct.

Can you file a JIRA with a test case?

On Thu, Jan 20, 2011 at 3:55 PM, ahmed.nagy <ah...@hotmail.com>wrote:

>
> I have two matrices A and B both of them are distributed row matrices I
> want
> to have the result of A * B' when I did that I got the values for A * B Any
> ideas how to compute A * B ' ?
> That is a bit of my code  this gives the result of A * B
>
> A=
> 1.000 2.000 3.000
> 4.000 5.000 6.000
> 7.000 8.000 9.000
> B'=
>
>
> Result expected
>  14.000  32.000  50.000
>  32.000  77.000 122.000
>  50.000 122.000 194.000
>
> Result printed
>
> The result of matrix AA'
> 30.0 36.0 42.0
> 66.0 81.0 96.0
> 102.0 126.0 150.0
>
> the result printed is basically A.A
>
> Matrix_v_mult_v_transpose=(Matrix_v.times(Matrix_v.transpose()));
>                        System.out.println("The result of matrix AA'");
>                        printDistributedMatrix(Matrix_v_mult_v_transpose);
>
> -----
> Ahmed Nagy
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Result-of-Matrix-Matrix-Transpose-tp2296621p2296621.html
> Sent from the Mahout User List mailing list archive at Nabble.com.
>