Question: Hi , this is my matrix multiplication program in scala i am trying to execute on data bricks, / / Define small matrices M and
Hi this is my matrix multiplication program in scala i am trying to execute on data bricks,
Define small matrices M and N
val M ArrayArray Array
val N ArrayArray Array
Convert small matrices to RDDs
val MRDDSmall scparallelizeMzipWithIndex.flatMap
case row i
row.zipWithIndex.map
case value j
itoInt, jtoInt value
val NRDDSmall scparallelizeNzipWithIndex.flatMap
case row i
row.zipWithIndex.map
case value j
itoInt, jtoInt value
Function to perform matrix multiplication of RDDs
def COOMatrixMultiplyM: RDDInt Int Double N: RDDInt Int Double: RDDInt Int Double
val MJoined Mmap
case i k valueki value
val NJoined Nmap
case k j valuekj value
MJoined.joinNJoinedmap
case i Mvalue Nvaluei j Mvalue Nvalue
reduceByKey
Perform matrix multiplication
val RRDDSmall COOMatrixMultiplyMRDDSmall NRDDSmall
Print the result
RRDDSmall.collectforeachprintln
but this is the errors i am facing:
command:: error: not found: value Mvalue
case i Mvalue Nvaluei j Mvalue Nvalue
command:: error: not found: value Nvalue
case i Mvalue Nvaluei j Mvalue Nvalue
command:: error: not found: value j
case i Mvalue Nvaluei j Mvalue Nvalue
command:: error: not found: value Mvalue
case i Mvalue Nvaluei j Mvalue Nvalue
command:: error: not found: value Nvalue
case i Mvalue Nvaluei j Mvalue Nvalue
can you please help me fix this so that the code runs on data bricks. I am not able to run this on data bricks. i have very little knowledge in scala and would like to have help.
Thank you so much
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
