Skip to content

Matrix returned when it should be hybrid matrix #52

@prittjam

Description

@prittjam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions