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

Cannot use view() on A_mul_B! #23

Open
biona001 opened this issue Aug 27, 2018 · 0 comments
Open

Cannot use view() on A_mul_B! #23

biona001 opened this issue Aug 27, 2018 · 0 comments

Comments

@biona001
Copy link
Member

biona001 commented Aug 27, 2018

Since A_mul_B accepts SnpLike{2} for the matrix argument, I thought I could use view() to do multiplication on just a subset of my snparray. However the following shows this cannot be done.

S = SnpArray(rand(0:2, 10, 10))
b = rand(5)
answer = zeros(5)

Do multiplication on the top left corner:

julia> A_mul_B!(answer, view(S, 1:5, 1:5), b, similar(answer))
ERROR: type SubArray has no field A1
Stacktrace:
 [1] A_mul_B!(::Array{Float64,1}, ::SubArray{Tuple{Bool,Bool},2,SnpArrays.SnpArray{2},Tuple{UnitRange{Int64},UnitRange{Int64}},false}, ::Array{Float64,1}, ::Array{Float64,1}) at /Users/biona001/.julia/v0.6/SnpArrays/src/SnpArrays.jl:728

edit:
Adding example to show that A_mul_B! works on subarrays without loading packages:

x = rand(10, 10)
b = rand(5)
answer = zeros(5)

julia> A_mul_B!(answer, view(x, 1:5, 1:5), b)
5-element Array{Float64,1}:
 1.59663
 1.19226
 1.17276
 0.675278
 1.56565
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

No branches or pull requests

1 participant