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

Method identity

matrix/matrix_class.py:150–155  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

148 return self.order[0] == self.order[1]
149
150 def identity(self) -> Matrix:
151 values = [
152 [0 if column_num != row_num else 1 for column_num in range(self.num_rows)]
153 for row_num in range(self.num_rows)
154 ]
155 return Matrix(values)
156
157 def determinant(self) -> int:
158 if not self.is_square:

Callers 2

__pow__Method · 0.95
test_identityFunction · 0.80

Calls 1

MatrixClass · 0.70

Tested by 1

test_identityFunction · 0.64