Skip to content

Add support for computing the hypotenuse via hypot #544

Closed
@kgryte

Description

@kgryte

This RFC requests to include a new API in the array API specification for the purpose of computing the hypotenuse.

Based on array comparison data, the API is available across all major array libraries in the PyData ecosystem (note: TensorFlow implements hypot in its experimental numpy namespace).

While hypot can be implemented in userland using existing array API functions (e.g., sqrt(x1*x1 + x2*x2)), this function is typically implemented in a specialized manner to help prevent over/underflow.

Furthermore, need for this API arose when adding complex number support to the array API specification, particularly with regard to adding complex number support to abs, where the absolute value (magnitude) of a complex number is computed as hypot(real(z), imag(z)).

As this API already exists in the ecosystem and satisfies needs (e.g., numerical stability and complex number support), this API seems a good candidate for inclusion in the standard.

Metadata

Metadata

Assignees

Labels

API extensionAdds new functions or objects to the API.

Type

No type

Projects

Status

Stage 2

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions