MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __mul__

Method __mul__

maths/matrix_exponentiation.py:22–28  ·  view source on GitHub ↗
(self, b: Matrix)

Source from the content-addressed store, hash-verified

20 self.t = [[0 for _ in range(self.n)] for _ in range(self.n)]
21
22 def __mul__(self, b: Matrix) -> Matrix:
23 matrix = Matrix(self.n)
24 for i in range(self.n):
25 for j in range(self.n):
26 for k in range(self.n):
27 matrix.t[i][j] += self.t[i][k] * b.t[k][j]
28 return matrix
29
30
31def modular_exponentiation(a: Matrix, b: int) -> Matrix:

Callers

nothing calls this directly

Calls 1

MatrixClass · 0.70

Tested by

no test coverage detected