mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Add array_is_constant
This commit is contained in:
parent
f5480d02ff
commit
db45d9e646
1 changed files with 3 additions and 0 deletions
|
@ -130,6 +130,9 @@ def arrays_match(arr1: np.ndarray, arr2: np.ndarray) -> bool:
|
|||
return arr1.shape == arr2.shape and (arr1 == arr2).all()
|
||||
|
||||
|
||||
def array_is_constant(arr: np.ndarray) -> bool:
|
||||
return len(arr) > 0 and not (arr - arr[0]).any()
|
||||
|
||||
def hash_obj(obj: object) -> int:
|
||||
if isinstance(obj, dict):
|
||||
return hash(tuple(sorted([
|
||||
|
|
Loading…
Add table
Reference in a new issue