(string: str)
| 71 | |
| 72 | |
| 73 | def string_to_array(string: str) -> np.ndarray: |
| 74 | # Convert strings of + and - to bool arrays |
| 75 | string = string.strip().replace("+", "1").replace("-", "-1").split() |
| 76 | return np.stack( |
| 77 | [ |
| 78 | np.fromstring(" ".join(string[i]), dtype=np.int32, sep=" ") |
| 79 | for i in range(len(string)) |
| 80 | ], |
| 81 | ) |
| 82 | |
| 83 | |
| 84 | def array_code_gen(arr: np.ndarray) -> str: |