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

Add a generic scal! #43931

Closed
wants to merge 1 commit into from
Closed

Conversation

amontoison
Copy link
Contributor

@amontoison amontoison commented Jan 25, 2022

scal! was only defined for Float32, Float64, ComplexF32 and ComplexF64 vectors.

@N5N3
Copy link
Member

N5N3 commented Jan 27, 2022

I'm not sure it a good idea to bring more BLAS api into LinearAlgebra.
Generic scal(!)(a, X) could be easily replaced with a * X and mul!(X, a, X).
The only problem needs to concern is #43153 (mul!(X, a, X) is a self-inplace broadcast).
But it could be fixed easily after we have purity inferability.

@ViralBShah
Copy link
Member

I tend to agree with @N5N3's comment. Closing for now, but happy to reopen if there's a good reason.

@ViralBShah ViralBShah closed this Mar 12, 2022
@ViralBShah ViralBShah added the linear algebra Linear algebra label Mar 12, 2022
@amontoison
Copy link
Contributor Author

amontoison commented Oct 18, 2024

@N5N3 @ViralBShah
Do we have a generic function to do a * X in-place now?
My main concern is how to add a dispatch on GPU arrays and I would like to avoid broadcast.

@ViralBShah
Copy link
Member

I thought we have a mul! method for this case.

julia> a
1

julia> X = rand(10,10);

julia> Y = zeros(10,10);

julia> @which mul!(Y,a,X)
mul!(C, A, B)
     @ LinearAlgebra ~/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/matmul.jl:253

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

Successfully merging this pull request may close these issues.

5 participants