Giter Site home page Giter Site logo

deltaarrays.jl's People

Contributors

github-actions[bot] avatar jofrevalles avatar mofeing avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

deltaarrays.jl's Issues

Ambiguous `similar` method error when performing operations between `DeltaArray`s and regular `Array`s

I am encountering an error ambiguity when I try to perform a contraction between a DeltaArray and a regular Array using the OMEinsum package. The error occurs when I use the einsum function:

julia> using DeltaArrays

julia> using OMEinsum

julia> darray = DeltaArray{3}(rand(2))
2×2×2 DeltaArray{Float64, 3, Vector{Float64}}:
[:, :, 1] =
 0.790413  0.0
 0.0       0.0

[:, :, 2] =
 0.0  0.0
 0.0  0.0187643

julia> array2 = rand(2, 2, 2)
2×2×2 Array{Float64, 3}:
[:, :, 1] =
 0.352157  0.502972
 0.474538  0.702706

[:, :, 2] =
 0.332013  0.730828
 0.407898  0.403412

julia> contracted = ein"ijk,jlm->iklm"(darray,array2)
ERROR: MethodError: similar(::DeltaArray{Float64, 3, Vector{Float64}}, ::Type{Float64}, ::Tuple{Int64, Int64, Int64}) is ambiguous. Candidates:
  similar(a::AbstractArray, ::Type{T}, dims::Tuple{Vararg{Int64, N}}) where {T, N} in Base at abstractarray.jl:806
  similar(a::AbstractArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}}) where T in Base at abstractarray.jl:804
  similar(a::AbstractArray, ::Type{T}, dims::Tuple{Union{Integer, Base.OneTo}, Vararg{Union{Integer, Base.OneTo}}}) where T in Base at abstractarray.jl:803
  similar(::DeltaArray, ::Type{T}, dims) where T in DeltaArrays at /home/jofrevalles/.julia/packages/DeltaArrays/xu4Xt/src/DeltaArrays.jl:159
Possible fix, define
  similar(::DeltaArray, ::Type{T}, ::Tuple{Int64, Vararg{Int64, N}}) where {T, N}
Stacktrace: ...

This error suggests that there is ambiguity in the similar method for DeltaArray. The error suggests the following possible fix:

similar(::DeltaArray, ::Type{T}, ::Tuple{Int64, Vararg{Int64, N}}) where {T, N}

I think it would be a good idea to implement this to allow for operations between DeltaArrays and regular Arrays, what do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.