Skip to content

Add method for multiply-add aka axpy #88

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

Closed
bluss opened this issue Feb 25, 2016 · 1 comment
Closed

Add method for multiply-add aka axpy #88

bluss opened this issue Feb 25, 2016 · 1 comment
Labels

Comments

@bluss
Copy link
Member

bluss commented Feb 25, 2016

Two reasons:

  • Blas offers this as axpy, so it can be optimized (note: axpy is for vectors, not strided matrix)
  • It's a common case.

This operation is already _available efficiently_ using .zip_mut_with:

a1.zip_mut_with(&a2, |x, &y| *x += k * y)

The question is if this is so common and the zip_mut_with so ugly that it warrants its own method.

@bluss
Copy link
Member Author

bluss commented Mar 15, 2016

This interface is actually cool:

        self.w += Scaled(-step, &dt1);
        self.y += Scaled(-step, &dt2);

The problem is that if we provide AddAssign for Scaled, we'd probably better implement all operators for Scaled, and that quickly grows out of proportion..

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

No branches or pull requests

1 participant