Any way to dot arrays of different type?

Open
#1,067 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
data

Research direction

Start with the Dot trait documentation linked in the issue and inspect its current type and scalar bounds. Determine whether mixed-element dot products are supported by the existing API; done means a documented, accepted approach or a clearly scoped API change with tests.

Written by the indexing model from the issue text.

Description

enhancement

As far as I understand it, the current implementation of the Dot Trait does not allow the user to dot Arrays containing different data types. Why is that and is there any way to get around this limitation?

To be clear, what i need is something like this:

impl<A, B, S, S2> Dot<ArrayBase<S2, Dim<[usize; 2]>>> for ArrayBase<S, Ix2> where
    S: Data<Elem = A>,
    S2: Data<Elem = B>,
    A: LinalgScalar, 
    B: LinalgScalar + Add<Rhs = A> + Mul<Rhs = A>,

As long as the Add and Mul trait bounds are satisfied, it should be possible to use the two data types in a dot operation, right?
Sorry if I am missing something obvious here.

Dominant language
Rust
Stars
4.3k
Forks
391
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.