Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description The purpose of this project is to develop a MapReduce program on Hadoop to multiply two sparse matrices. Project Description For this project, you
Description
The purpose of this project is to develop a MapReduce program on Hadoop to multiply two sparse matrices.
Project Description
For this project, you are asked to implement matrix multiplication in MapReduce. You should modify Multiply. java only. In your Java main program, args is the first input matrix M args is the second input matrix N args is the directory name to pass the intermediate results from the first MapReduce job to the second, and args is the output directory. All the input and output file formats must be text formats. There are two small sparse matrices in the files Mmatrixsmall. txt and Nmatrixsmall. txt for testing in standalone mode. Their matrix multiplication must return the result matrix in solutionsmall.txt
PseudoCode
class Elem extends Writable
shot tex; one othe fodexes the other is used as a key
double value;
class
Pair extends WritableComparable int i; int j;
First MapReduce job: map key line
mapper for matrix M
split line into values: i j and v emit j new Elem i v
First MapReduce job: map key line
mapper for matrix M
split line into values: i j and v emit j new Elem i v
map key line
mapper for matrix N
split line into values: i j and v emit i new Elem jv
reduce index values
A all v in values with vtag
B all v in values with vtag
for a in A
for b in B
emit new Pair a index, b indexa valuebvalue
Second MapReduce job:
map key value do nothing
emit key value
reduce pair values do the summation
m
for v in values
m mv
emit pair m
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started