Vandexel
Vandexel

Reputation: 639

How many operations does scalar multiplication of a matrix take?

I know that matrix addition of matrixes takes n^2 operations, and matrix multiplication takes n^3 operations. Does scalar multiplication of a matrix also take n^3 operations, or is it a different number?

Thanks!

Upvotes: 0

Views: 271

Answers (1)

Hun
Hun

Reputation: 3857

Sounds like you are talking about a square matrix. Let me generalize a bit and lets consider a m x n matrix.

3 x 2 matrix multiplication example

  • Matrix addition will take m x n since you are adding each element
  • Matrix multiplication will take n + (n-1) for each element since you have to add the result of each multiplication. Multiply that with the total number of elements of resulting matrix which is m x m. Thus, the matrix multiplication will take (2n-1) x m^2.
  • Matrix multiplication with a scalar will take m x n operation like matrix addition since it is operated on each element.

Upvotes: 1

Related Questions