1

I'm trying to perform a matrix multiplication on a simple 3 X 3 matrix using Pig. I'm neither unable to perform transpose nor group according to the row.

Can someone help me on this please.

Example

Matrix A:

2  2  2 
2  2  2
2  2  2

Matrix B:

1  1  1
1  1  1    
1  1  1

Thanks in advance !

Mzf
  • 5,210
  • 2
  • 24
  • 37
Anil
  • 420
  • 2
  • 16
  • 1
    What have you tried so far? How are the matrices stored? Is A a relation where each row is a tuple with the matrix row? Is A a relation where each relation is a bag with a matrix in it (several matrices in one relation or only one in each relation)? – Balduz May 07 '15 at 08:48

1 Answers1

0

Assuming your matrices are stored as "row, column, value", you can check this

Also if you have a txt file for the same, you can load that by:

E = LOAD 'matrix1.txt' USING PigStorage(',') AS (row:chararray, col:chararray, val:float);

OR

E = LOAD 'M-matrix-small.txt' USING PigStorage(',') AS (row, col, val);
Community
  • 1
  • 1
BrijD
  • 103
  • 1
  • 2
  • 10