Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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