point¶
A point as a collection of coordinates in real space.
- class parityos.utils.point.RealT¶
A constrained
TypeVarrepresenting a real number. Restricted toint,floatanddecimal.Decimal.alias of TypeVar(‘RealT’, int, float, ~decimal.Decimal)
- class parityos.utils.point.Point¶
-
Base class for Points in real space.
Coordinates can be of type
floatordecimal.Decimal.- abstractmethod classmethod from_coordinates(coordinates: Sequence[RealT], /) Self¶
Construct a
Pointfrom a sequence of its coordinates.
- property squared_norm: RealT¶
The squared Euclidean norm of the point.
- Returns:
The sum of squares of the coordinates.
- property norm: float¶
The Euclidean norm of the point.
- Returns:
The square root of the sum of squares of the coordinates.
- __getitem__(index: int, /) RealT¶
Get coordinate at
index.- Returns:
Coordinate at
index.- Raises:
IndexError – If
indexis out of bounds.
- __neg__() Self¶
The negative of the point.
- Returns:
A
Pointwith the same coordinates, but of opposite sign.
- __add__(other: Self, /) Self¶
The addition operator
+.Addition is element-wise in the coordinates. Only supported between equal type
Pointinstances.
- __sub__(other: Self, /) Self¶
Subtraction operator
-.Subtraction is element-wise in the coordinates. Only supported between equal type
Pointinstances.
- __mul__(other: RealT, /) Self¶
Scalar multiplication operator
*.Type checking is only supported for multiplication with a scalar of same type as the coordinates of
self.- Parameters:
other – Scalar factor to multiply
selfwith.- Returns:
A new
Pointwith the coordinates ofselfmultiplied withother.
- class parityos.utils.point.Point1D(x: RealT)¶
-
A one-dimensional
Pointon a line with a single coordinatex.
- class parityos.utils.point.Point2D(x: RealT, y: RealT)¶
-
A two-dimensional
Pointon a plane with coordinatesxandy.
- class parityos.utils.point.Point3D(x: RealT, y: RealT, z: RealT)¶
-
A three-dimensional
Pointin space with coordinatesx,yandz.