MCPcopy Create free account
hub / github.com/NVlabs/LongLive / string_to_array

Function string_to_array

fouroversix/scripts/hadamard_code_gen.py:73–81  ·  view source on GitHub ↗
(string: str)

Source from the content-addressed store, hash-verified

71
72
73def 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
84def array_code_gen(arr: np.ndarray) -> str:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected