You can again follow the definition given: to calculate the product of a number and a matrix, multiply each matrix element by that number.
$$0.5 \cdot \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} =
= \begin{bmatrix} 0.5 \cdot 1 & 0.5 \cdot 2 \\ 0.5 \cdot 3 & 0.5 \cdot 4\end{bmatrix} = \begin{bmatrix} 0.5 & 1 \\ 1.5 & 2 \end{bmatrix}$$
@[solution]({"id": "linear_algebra__scalar_multiplication_solution", "codePath": "Solution.qs"})microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
katas/content/linear_algebra/scalar_multiplication/solution.md
6lines · modepreview