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

Deprecate scale #15258

Merged
merged 1 commit into from
Mar 1, 2016
Merged

Deprecate scale #15258

merged 1 commit into from
Mar 1, 2016

Conversation

andreasnoack
Copy link
Member

In favor of Diagonal(x)*A or α*A.

Fixes #12945.

Update: Note that the potential small slowdown of Diagonal(x)*A instead of scale(x,A) should be eliminated thanks to #15259.

@@ -1,2 +1,2 @@
OPENBLAS_BRANCH=v0.2.15
OPENBLAS_SHA1=53e849f4fcae4363a64576de00e982722c7304f9
OPENBLAS_BRANCH=develop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't hide this in an unrelated pr

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaky sneaky.


If ``A`` is a matrix and ``b`` is a vector, then ``scale(A,b)`` scales each column ``i`` of ``A`` by ``b[i]`` (similar to ``A*diagm(b)``\ ), while ``scale(b,A)`` scales each row ``i`` of ``A`` by ``b[i]`` (similar to ``diagm(b)*A``\ ), returning a new array.

Note: for large ``A``\ , ``scale`` can be much faster than ``A .* b`` or ``b .* A``\ , due to the use of BLAS.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is this not true any more?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation suggestion is to use Diagonal(b)*A which calls BLAS. Actually, the difference is not really because of BLAS, but broadcasting overhead. With a nested loop, the code vectorizes and is as fast as BLAS on my machine.

We could move the "Note" to an entry for *(Diagonal,Matrix) or broadcast, but I'm not sure it will be easy to find in any of those places.

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

Successfully merging this pull request may close these issues.

3 participants