Re: [julia-users] Are SubArrays intended to work with BLAS functions?

2016-10-13 Thread Josh Day
Sure thing:  https://github.com/JuliaLang/julia/issues/18908


Re: [julia-users] Are SubArrays intended to work with BLAS functions?

2016-10-13 Thread Stefan Karpinski
Seems like a bug to me. Can you file an issue?

On Thu, Oct 13, 2016 at 10:13 AM, Josh Day  wrote:

> After much confusion, I discovered That BLAS.syr! gives incorrect results
> when using a view.  Is this a bug, or is it not recommended to use views
> with BLAS functions?
>
>
> julia> a1 = zeros(2,2); a2 = zeros(2, 2); x = randn(5, 2);
>
> julia> BLAS.syr!('U', 1.0, view(x, 1, :), a1)
> 2×2 Array{Float64,2}:
>  0.483364  0.440104
>  0.0   0.400716
>
> julia> BLAS.syr!('U', 1.0, x[1, :], a2)
> 2×2 Array{Float64,2}:
>  0.483364  0.458034
>  0.0   0.434032
>
> However, BLAS.syrk! appears to work:
>
> julia> a1 = zeros(2,2); a2 = zeros(2, 2); x = randn(5, 2);
>
> julia> BLAS.syrk!('U', 'T', 1.0, x, 0.0, a1)
> 2×2 Array{Float64,2}:
>  4.16346  -0.618009
>  0.0   4.75777
>
> julia> BLAS.syrk!('U', 'T', 1.0, view(x, :, :), 0.0, a2)
> 2×2 Array{Float64,2}:
>  4.16346  -0.618009
>  0.0   4.75777
>


[julia-users] Are SubArrays intended to work with BLAS functions?

2016-10-13 Thread Josh Day
After much confusion, I discovered That BLAS.syr! gives incorrect results 
when using a view.  Is this a bug, or is it not recommended to use views 
with BLAS functions?  


julia> a1 = zeros(2,2); a2 = zeros(2, 2); x = randn(5, 2);

julia> BLAS.syr!('U', 1.0, view(x, 1, :), a1)
2×2 Array{Float64,2}:
 0.483364  0.440104
 0.0   0.400716

julia> BLAS.syr!('U', 1.0, x[1, :], a2)
2×2 Array{Float64,2}:
 0.483364  0.458034
 0.0   0.434032

However, BLAS.syrk! appears to work:

julia> a1 = zeros(2,2); a2 = zeros(2, 2); x = randn(5, 2);

julia> BLAS.syrk!('U', 'T', 1.0, x, 0.0, a1)
2×2 Array{Float64,2}:
 4.16346  -0.618009
 0.0   4.75777

julia> BLAS.syrk!('U', 'T', 1.0, view(x, :, :), 0.0, a2)
2×2 Array{Float64,2}:
 4.16346  -0.618009
 0.0   4.75777