mirror of https://github.com/Nonannet/copapy.git
__repr__ and type hints for quaternion class updated
This commit is contained in:
parent
5d3d6bdf63
commit
139cfad9dd
|
|
@ -31,6 +31,8 @@ def grad(x: Any, y: value[Any] | Sequence[value[Any]] | vector[Any] | tensor[Any
|
|||
"""
|
||||
assert isinstance(x, value), f"Argument x for grad function must be a copapy value but is {type(x)}."
|
||||
|
||||
y_set: set[value[float] | float]
|
||||
|
||||
if isinstance(y, value):
|
||||
y_set = {y}
|
||||
if isinstance(y, tensor):
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class quaternion(ArrayType[float]):
|
|||
return self.norm()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"vector({self.values})"
|
||||
return f"quaternion(w={self.w}, x={self.x}, y={self.y}, z={self.z})"
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self.values)
|
||||
|
|
|
|||
Loading…
Reference in New Issue