I am working through the Rosetta Code challenges here on FCC. In the Element-wise operations challenge, one is required to write a function which takes an operation and two matrices as argument and perform basic element-wise
I know how to implement element-wise
matrix-matrix operation but what is not clear is
scalar-matrix operation. Every element of a matrix can be multiplied by a scalar but how do you perform
scalar-matrix operation on two matrices?
This particular test case is:
operation("s_add",[[1,2],[3,4]],[[1,2],[3,4]]) should return [[3,4],[5,6]].
I have looked at the original challenge on rosettacode.org but they don’t seem to emphasise the
scalar-matrix operations part.