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

MArray compatibility #546

Closed
wants to merge 4 commits into from
Closed

MArray compatibility #546

wants to merge 4 commits into from

Conversation

YingboMa
Copy link
Member

There is

    f₀ = zero.(u0./t)
    u0 isa MArray && (f₀ = MArray(f₀))

because broadcasting an MArray results an SArray.

julia> ode.u0
2-element MArray{Tuple{2},Float64,1,2}:
 1.0
 2.0

julia> ode.u0 ./ 1
2-element SArray{Tuple{2},Float64,1,2}:
 1.0
 2.0

@ChrisRackauckas
Copy link
Member

IMO this is just a bug JuliaArrays/StaticArrays.jl#327 and we shouldn't work around this.

@ChrisRackauckas
Copy link
Member

If we can, we should just give an upstream PR

@ChrisRackauckas
Copy link
Member

looks like SArray tests fail here?

@YingboMa
Copy link
Member Author

YingboMa commented Nov 1, 2018

Ah, right. Maybe we should explicitly cast the type to be MArray(m) in the meantime? I really want to get OrdinaryDiffEq.jl to work with MArrays.

@ChrisRackauckas
Copy link
Member

Similar with element types doesn't exist for MArrays?

@YingboMa
Copy link
Member Author

YingboMa commented Nov 1, 2018

It does, but we cannot do oneunit(m::MArray), because Julia doesn't have that method anymore...

@ChrisRackauckas
Copy link
Member

oneunit(first(x))? That won't do well with GPUArrays...

@ChrisRackauckas
Copy link
Member

oneunit(eltype(m))

@YingboMa
Copy link
Member Author

YingboMa commented Nov 1, 2018

@ChrisRackauckas
Copy link
Member

recursive_bottom_eltype(m).

@YingboMa
Copy link
Member Author

YingboMa commented Nov 1, 2018

That doesn't seem to work either...

julia> u0 = fill(zero(MVector{2,Float64}), 2); t = 0.1;

julia> similar(u0)
2-element Array{MArray{Tuple{2},Float64,1,2},1}:
 #undef
 #undef

julia> similar(u0, eltype(eltype(u0)))
2-element Array{Float64,1}:
 6.9502444917253e-310
 6.9502444933561e-310

julia> similar(u0, typeof(oneunit(eltype(eltype(u0)))/oneunit(t)))
2-element Array{Float64,1}:
 6.9501798101687e-310
 6.9501798097537e-310

@ChrisRackauckas
Copy link
Member

This fix is really sketch and fails tests.

@YingboMa YingboMa closed this Nov 1, 2018
@YingboMa YingboMa deleted the myb/marray branch November 1, 2018 20:48
@YingboMa
Copy link
Member Author

YingboMa commented Nov 1, 2018

In favor of JuliaArrays/StaticArrays.jl#536

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 this pull request may close these issues.

2 participants