dimforge / dimforge/alga

Are the real numbers a normed space?

Open
#89 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
201
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I'm very much not a mathematician, nor am I a Rust expert, so please forgive me if this is a silly question.

I'm working on a spline implementation which I will mostly use for 3D curves, but I would also like it to work for 2D curves and for 1D (I don't know if those can still be called "curves").

For 2D and 3D I'm using vector types from the `nalgebra` crate (which implement several `alga` traits).

Since my implementation is supposed to work on any vector space that has a norm, I think it would make sense to use the `alga::linear::NormedSpace` trait bound.

For the 1D case I could of course use a 1D vector from `nalgebra`, but I think it would be much nicer if I could also use a "normal" scalar type, like e.g. `f64`.

This doesn't work though, because `NormedSpace` doesn't seem to be implemented for `f64` (it looks like it's only implemented for `Complex`).

Now my question: are real numbers a normed space?
I would think so, but what do I know ...

If that makes at least some mathematical sense, would it be possible to implement `NormedSpace` for scalars?

I'm thinking about something like this:

```rust
impl NormedSpace for T {
type RealField = T;

...

fn norm(&self) -> T {
self.abs()
}

...
}
```

Or probably this should use `ComplexField` instead?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.