remove global functions

This commit is contained in:
2024-05-26 13:59:36 -05:00
parent c58a0a1ba7
commit ca8cb7280d
3 changed files with 127 additions and 22 deletions

View File

@@ -89,6 +89,23 @@ class DarcKey(BaseModel):
key_type=self.key_type
)
def __eq__(self, other) -> bool:
if self.key_type != other.key_type:
return False
if len(self.matrix) != len(other.matrix):
return False
if len(self.matrix[0]) != len(other.matrix[0]):
return False
for i in range(len(self.matrix)):
for j in range(len(self.matrix[0])):
if self.matrix[i][j] != other.matrix[i][j]:
return False
return True
def column_substitution(self, column: int, substitution: list[int]):
assert len(substitution) == len(self.matrix)
assert len(self.matrix[0]) > column >= 0