Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add traits for generic norms and distances #130

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Nuramon27
Copy link

This is the implementation mentioned in #121.
Regarding the issue that there are many possible norms for a certain type (see comment #121 (comment) ): I think these traits would only be intended to be implemented on very basic types for which there is some notion of a standard norm, like the absolute value on floating point numbers and the euclidean norm on complex numbers and one-dimensional arrays.

Indeed in the meantime I started working a separate crate Norman which handles exactly this issue and provides a set of different norms on a single type.

I hoped that both might go well with each other: having num-traits for a simple answer to the question “how far are these two vectors apart” and a dedicated crate if full control is necessary over how this distance is calculated.

… of distances between numbers.

The `Norm` trait provides a `norm` function for types that represent a normed vector space – e.g. the absolute value of a float or the norm of a complex number.

The `Distance` trait provides a `distance` function to still calculate the distance between two values if no sensible norm can be defined.
@jsmith628
Copy link

You could check out my maths-traits crate. While it doesn't currently have impls for the structs in the num collection, there are norm, metric, and inner product traits, and I'd be open to contributions or feature requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants