CSE6332 -Cloud-and-big-data PROJECT-2 For this project, you are asked Solution
to implement block matrix addition in Map-Reduce. You will take two sparse matrices as input, convert them to block matrices, and then perform block matrix addition on them. The sum of two matrices M and N is the matrix R such that Rij = Mij + Nij. A sparse matrix is a dataset of triples (i, j, v), where i and j are the indices and v is the matrix value at the indices i and j. A triple is constructed with the Java class Triple. A block matrix is a dataset of blocks. Each block is a dense Java matrix of size rows * columns constructed with the Java class Block (the values rows and columns are program arguments). A block matrix is stored in HDFS as a binary file (in SequenceTextInputFormat) of key-values, where the key is a pair of block coordinates (ci, cj) (constructed with the Java class Pair) and the value is a block. A matrix element Mij is stored inside the block with block coordinates (i/rows, j/columns) at the location (i%rows, j%columns) inside the block. The block matrix addition of M and N is done by finding blocks from M and N with the same block coordinates and by adding the blocks together using regular matrix addition in Java. Your project is to convert two sparse matrices M and N which are read from files to block matrices and then add them using block matrix addition. First, you need to convert a sparse matrix to a block matrix using the following Map-Reduce pseudo-code (called twice, for M and for N):