Utilities

Data Type Management

promote_arg_dtypes(*args)

Promotes args to a common inexact type.

check_shapes_are_equal(array1, array2)

Raise an error if the shapes of the two arrays do not match.

canonicalize_dtype(dtype)

Wrapper function on dtypes.canonicalize_dtype with None handling

promote_to_complex(arg)

Promotes an argument to complex type

promote_to_real(arg)

Promotes an argument to real type

System Information

platform

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

is_cpu()

Returns True if the code is running on a CPU platform

is_gpu()

Returns True if the code is running on a GPU platform

is_tpu()

Returns True if the code is running on a TPU platform

nbytes_live_buffers()

Returns the number of bytes consumed by the live buffers

2D Geometry

Points and Vectors

point2d(x, y)

A point in 2D vector space

vec2d(x, y)

A vector in 2D vector space

Transformations

rotate2d_cw(theta)

Construct an operator that rotates a 2D vector by angle :math:` heta` clock-wise

rotate2d_ccw(theta)

Construct an operator that rotates a 2D vector by angle :math:` heta` counter-clock-wise

reflect2d(theta)

Construct an operator that reflects a 2D vector across a line defined at angle :math:` heta/2`