Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Aug 9, 2024
1 parent 86c2738 commit 617d0a6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions brainunit/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,17 @@ def __init__(
self._unit = unit

@property
def mantissa(self):
def mantissa(self) -> jax.typing.ArrayLike:
r"""
The mantissa of the array.
In the scientific notation, :math:`x = a * 10^b`, the mantissa :math:`a` is the part of
a floating-point number that contains its significant digits. For example, in the number
:math:`3.14 * 10^5`, the mantissa is :math:`3.14`.
Returns:
The mantissa of the array.
"""
return self._mantissa

def update_value(self, mantissa: PyTree):
Expand Down Expand Up @@ -1918,8 +1928,9 @@ def has_same_unit(self, other):
bool
Whether the two Arrays have the same unit dimensions
"""
other_unit = get_dim(other.dim)
return (get_dim(self.dim) is other_unit) or (get_dim(self.dim) == other_unit)
self_dim = get_dim(self.dim)
other_dim = get_dim(other.dim)
return (self_dim is other_dim) or (self_dim == other_dim)

def repr_in_unit(
self,
Expand Down

0 comments on commit 617d0a6

Please sign in to comment.