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

Matrix returned when it should be hybrid matrix #52

Open
prittjam opened this issue Sep 5, 2022 · 2 comments · Fixed by #54
Open

Matrix returned when it should be hybrid matrix #52

prittjam opened this issue Sep 5, 2022 · 2 comments · Fixed by #54

Comments

@prittjam
Copy link

prittjam commented Sep 5, 2022

This casts to a dynamic matrix.

d1 = HybridMatrix{3,StaticArrays.Dynamic()}(rand(3,100))
d2 = HybridMatrix{3,StaticArrays.Dynamic()}(rand(3,100))
@tullio d3[i,j] := d1[i,j]*d2[i,j] 
julia> axes(d1)
(SOneTo(3), Base.OneTo(100))

julia> similar(d1, Float32, axes(d1, 1))
3-element HybridVector{3, Float32, 1, Vector{Float32}} with indices SOneTo(3):
 -1.1286683f-36
  3.0f-45
 -1.14295445f-36

julia> similar(d1, Float32, axes(d1))  # here I'd expect a HybridMatrix
3×100 Matrix{Float32}:
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  …  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0     0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

julia> @tullio d3[i,j] := d1[i,j]*d2[i,j] 
3×100 Matrix{Float64}:
 0.123891   0.0125692  0.036221    0.358743     …  0.502666   0.0288498  0.123871  0.00600215
 0.0817757  0.0308924  0.00914702  0.0365981       0.446563   0.668597   0.331555  0.00121783
 0.129901   0.574357   0.0113905   0.000131267     0.0395467  0.310613   0.606306  0.288098

This is from a discussion on Tullio issues.

@mateuszbaran
Copy link
Collaborator

It seems that HybridArrays needs a few more methods of similar, I should be able to fix it tomorrow.

@mateuszbaran
Copy link
Collaborator

Reopened because #54 doesn't fully solve the issue.

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 a pull request may close this issue.

2 participants