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

Hermitian matrix multiplication relies on BLAS function that isn't wrapped #11127

Closed
kshyatt opened this issue May 4, 2015 · 0 comments
Closed
Labels

Comments

@kshyatt
Copy link
Contributor

kshyatt commented May 4, 2015

In base/linalg/symmetric.jl, to multiply a general matrix by a Hermitian one, we can use:
A_mul_B!{T<:BlasComplex,S<:AbstractMatrix}(y::StridedMatrix{T}, A::Hermitian{T,S}, x::StridedMatrix{T}) = BLAS.hemm!(A.uplo, one(T), A.data, B, zero(T), C)

Cool! But in blas.jl, there's no wrapper for hemm! or hemm. Also, this takes x and y as args, yet passes B and C which AFAICT don't exist.

Here is a demonstration:

julia> A = randn(3,3)
3x3 Array{Float64,2}:
 0.37118   -0.115637  -0.2626
 1.44327   -0.3389    -1.36312
 0.402348   0.465449  -0.281456

julia> B = randn(3,3)
3x3 Array{Float64,2}:
  0.63778   -0.577948   0.365766
  1.185      0.115811   1.06565
 -0.446381  -0.329414  -0.504115

julia> C = complex(A,B)
3x3 Array{Complex{Float64},2}:
  0.37118+0.63778im   -0.115637-0.577948im    -0.2626+0.365766im
  1.44327+1.185im       -0.3389+0.115811im   -1.36312+1.06565im
 0.402348-0.446381im   0.465449-0.329414im  -0.281456-0.504115im

julia> C = C + C'
3x3 Array{Complex{Float64},2}:
  0.74236+0.0im         1.32763-1.76295im   0.139748+0.812146im
  1.32763+1.76295im   -0.677799+0.0im      -0.897673+1.39507im
 0.139748-0.812146im  -0.897673-1.39507im  -0.562913+0.0im

julia> C = Hermitian(C)
3x3 Base.LinAlg.Hermitian{Complex{Float64},Array{Complex{Float64},2}}:
  0.74236-0.0im         1.32763-1.76295im   0.139748+0.812146im
  1.32763+1.76295im   -0.677799-0.0im      -0.897673+1.39507im
 0.139748-0.812146im  -0.897673-1.39507im  -0.562913-0.0im

julia> D = complex(A,B)
3x3 Array{Complex{Float64},2}:
  0.37118+0.63778im   -0.115637-0.577948im    -0.2626+0.365766im
  1.44327+1.185im       -0.3389+0.115811im   -1.36312+1.06565im
 0.402348-0.446381im   0.465449-0.329414im  -0.281456-0.504115im

julia> C*D
ERROR: UndefVarError: hemm! not defined
 in * at linalg/matmul.jl:121
@tkelman tkelman added the domain:linear algebra Linear algebra label May 4, 2015
kshyatt added a commit to kshyatt/julia that referenced this issue May 4, 2015
kshyatt added a commit to kshyatt/julia that referenced this issue May 4, 2015
andreasnoack added a commit that referenced this issue May 5, 2015
Fix #11127 Hermitian matrix multiplication
mbauman pushed a commit to mbauman/julia that referenced this issue Jun 6, 2015
tkelman pushed a commit to tkelman/julia that referenced this issue Jun 6, 2015
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

2 participants