Skip to content

Left multiplication for vector spaces #24

Open
@milibopp

Description

@milibopp

This code example fails:

fn foo<V: VectorSpace<Field=f64>>(a: V, b: V, c: f64) -> V {
    a * c + c * b
}

with this error:

error[E0277]: the trait bound `f64: std::ops::Mul<V>` is not satisfied
   |
   |     a * c + c * b
   |               ^ no implementation for `f64 * V`
   |
   = help: the trait `std::ops::Mul<V>` is not implemented for `f64`
   = help: consider adding a `where f64: std::ops::Mul<V>` bound

(omitted source location in my project for clarity)

Is there a reason, why this can't be made work? As multiplication on the field commutes anyway, the operator should generally be available in this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions