I was going through Matrix4 in the tutorial earlier today and was confused as to why this piece of code was creating a Seq from 1 to m instead of 1 to n
sc.parallelize(1 to dimensions.m)
I launched the code in a debugger and it turns out that the problem was with the handling of the regex being converted into the Dimensions case class. The line case dimsRE(m, n) => Dimensions(m.toInt, n.toInt) switches the order of the dimensions and then passes them to Dimensions. The code still works as intended because the rest of it refers to m as the number of rows and n as the number of columns
The below screenshot was taken while debugging Matrix4 using the default arguments
In my fix, I swapped the ordering of m and n to reflect the original intent and edited a few bits of code so that the output would still be as intended
I was going through
Matrix4
in the tutorial earlier today and was confused as to why this piece of code was creating aSeq
from1 to m
instead of1 to n
sc.parallelize(1 to dimensions.m)
I launched the code in a debugger and it turns out that the problem was with the handling of the regex being converted into the
Dimensions
case class. The linecase dimsRE(m, n) => Dimensions(m.toInt, n.toInt)
switches the order of the dimensions and then passes them toDimensions
. The code still works as intended because the rest of it refers tom
as the number of rows andn
as the number of columnsThe below screenshot was taken while debugging
Matrix4
using the default argumentsIn my fix, I swapped the ordering of
m
andn
to reflect the original intent and edited a few bits of code so that the output would still be as intended