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

Dot product with dyn arrays #886

Closed
FredrikNoren opened this issue Jan 7, 2021 · 4 comments
Closed

Dot product with dyn arrays #886

FredrikNoren opened this issue Jan 7, 2021 · 4 comments

Comments

@FredrikNoren
Copy link

Hi, for some reason this isn't working for me:

let a = array![[1.]].into_dyn();
let b = array![[1.]].into_dyn();
let c = a.dot(&b);

I'm getting this error:

no method named `dot` found for struct `ArrayBase<OwnedRepr<{float}>, Dim<IxDynImpl>>` in the current scope
method not found in `ArrayBase<OwnedRepr<{float}>, Dim<IxDynImpl>>`

Am I doing something wrong or is this a bug? Version 0.14.0

@jturner314
Copy link
Member

The dot product isn't implemented for dynamic-dimensional arrays right now, although I wouldn't be opposed to adding these implementations. For the time being, you can work around this by converting dynamic-dimensional arrays into const-dimensional arrays with .into_dimensionality() before calling .dot().

@FredrikNoren
Copy link
Author

@jturner314 Ah ok perfect, thanks!

@georgikolev17
Copy link

georgikolev17 commented Apr 20, 2023

The dot product isn't implemented for dynamic-dimensional arrays right now, although I wouldn't be opposed to adding these implementations. For the time being, you can work around this by converting dynamic-dimensional arrays into const-dimensional arrays with .into_dimensionality() before calling .dot().

And how do I change the result dimensions back to the previous ones after that?

@akern40
Copy link
Collaborator

akern40 commented Mar 18, 2025

Closed by #1483

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