mirror of
https://github.com/Brandon-Rozek/matmod.git
synced 2024-11-20 21:56:29 -05:00
Parsing as regular decimal integers instead of hexadecimal. (PR #6)
This commit is contained in:
commit
960fa82237
1 changed files with 4 additions and 5 deletions
|
@ -80,9 +80,8 @@ def carrier_set_from_size(size: int):
|
||||||
def parse_size(infile: TextIO) -> Optional[int]:
|
def parse_size(infile: TextIO) -> Optional[int]:
|
||||||
"""
|
"""
|
||||||
Parse the line representing the matrix size.
|
Parse the line representing the matrix size.
|
||||||
NOTE: Elements are represented in hexidecimal.
|
|
||||||
"""
|
"""
|
||||||
size = int(next(infile), 16)
|
size = int(next(infile))
|
||||||
if size == -1:
|
if size == -1:
|
||||||
return None
|
return None
|
||||||
assert size > 0, "Unexpected size"
|
assert size > 0, "Unexpected size"
|
||||||
|
@ -110,16 +109,16 @@ def parse_negation(infile: TextIO, size: int) -> Optional[ModelFunction]:
|
||||||
|
|
||||||
def mvalue_from_index(i: int):
|
def mvalue_from_index(i: int):
|
||||||
"""
|
"""
|
||||||
Given an index, return the hexidecimal
|
Given an index, return the
|
||||||
representation of the model value.
|
representation of the model value.
|
||||||
"""
|
"""
|
||||||
return ModelValue(f"a{hex(i)[-1]}")
|
return ModelValue(f"a{i}")
|
||||||
|
|
||||||
def parse_mvalue(x: str) -> ModelValue:
|
def parse_mvalue(x: str) -> ModelValue:
|
||||||
"""
|
"""
|
||||||
Parse an element and return the model value.
|
Parse an element and return the model value.
|
||||||
"""
|
"""
|
||||||
return mvalue_from_index(int(x, 16))
|
return mvalue_from_index(int(x))
|
||||||
|
|
||||||
def determine_cresult(size: int, ordering: Dict[ModelValue, ModelValue], a: ModelValue, b: ModelValue) -> ModelValue:
|
def determine_cresult(size: int, ordering: Dict[ModelValue, ModelValue], a: ModelValue, b: ModelValue) -> ModelValue:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue