Question: This is my matrix vector multiplication - i want to see how the values get multiplied.. can you use pen and paper to show how
This is my matrix vector multiplication
i want to see how the values get multiplied.. can you use pen and paper to show how the matrix and vector gets multiplied using the logic given below? Like how the row of one matrix and the column of the other matrix gets joined and multiplied? please work it out and show me Thank you so much
import org.apache.spark.sqltypes.
import org.apache.spark.sqlfunctions.
Define matrix and vector data as sequences
val matrixxSeq Seq
val vectorySeq Seq
Convert matrix and vector data to DataFrames
val matrixxDF matrixxSeq.toDFrow "col", "val"
val vectoryDF vectorySeq.toDFrow "val"
Show DataFrames
matrixxDFshow
vectoryDFshow
matrixxDFcreateOrReplaceTempViewX
vectoryDFcreateOrReplaceTempViewY
val resultDF spark.sql
SELECT Xrow, SUMXval Yval AS val
FROM X
JOIN Y ON Xcol Yrow
GROUP BY Xrow
resultDF.show
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
