Skip to content

[BUG] contract fails for zerodim input #16

Closed
@ogauthe

Description

@ogauthe

Thanks for #15 . I find there is still a problem for zero-dim input:

contract((1,), ones((1,)), (1,), ones(()), ())
ERROR: MethodError: no method matching output_axes(::typeof(contract), ::TensorAlgebra.BlockedPermutation{…}, ::Vector{…}, ::TensorAlgebra.BlockedPermutation{…}, ::Array{…}, ::TensorAlgebra.BlockedPermutation{…}, ::Bool)
The function `output_axes` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  output_axes(::typeof(contract), ::TensorAlgebra.BlockedPermutation{1}, ::AbstractArray, ::TensorAlgebra.BlockedPermutation{1}, ::AbstractArray, ::TensorAlgebra.BlockedPermutation{2}, ::Number)
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/allocate_output.jl:39
  output_axes(::typeof(contract), ::TensorAlgebra.BlockedPermutation{2}, ::AbstractArray, ::TensorAlgebra.BlockedPermutation{1}, ::AbstractArray, ::TensorAlgebra.BlockedPermutation{1}, ::Number)
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/allocate_output.jl:71
  output_axes(::typeof(contract), ::TensorAlgebra.BlockedPermutation{1}, ::AbstractArray, ::TensorAlgebra.BlockedPermutation{2}, ::AbstractArray, ::TensorAlgebra.BlockedPermutation{1}, ::Number)
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/allocate_output.jl:55
  ...

Stacktrace:
 [1] allocate_output(::typeof(contract), biperm_dest::TensorAlgebra.BlockedPermutation{…}, a1::Vector{…}, biperm1::TensorAlgebra.BlockedPermutation{…}, a2::Array{…}, biperm2::TensorAlgebra.BlockedPermutation{…}, α::Bool)
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/allocate_output.jl:97
 [2] contract(alg::TensorAlgebra.Matricize, biperm_dest::TensorAlgebra.BlockedPermutation{…}, a1::Vector{…}, biperm1::TensorAlgebra.BlockedPermutation{…}, a2::Array{…}, biperm2::TensorAlgebra.BlockedPermutation{…}, α::Bool; kwargs::@Kwargs{})
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:121
 [3] contract(alg::TensorAlgebra.Matricize, biperm_dest::TensorAlgebra.BlockedPermutation{…}, a1::Vector{…}, biperm1::TensorAlgebra.BlockedPermutation{…}, a2::Array{…}, biperm2::TensorAlgebra.BlockedPermutation{…}, α::Bool)
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:111
 [4] contract(alg::TensorAlgebra.Matricize, labels_dest::Tuple{Int64}, a1::Vector{Float64}, labels1::Tuple{Int64}, a2::Array{Float64, 0}, labels2::Tuple{}, α::Bool; kwargs::@Kwargs{})
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:92
 [5] contract
   @ ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:81 [inlined]
 [6] #contract#29
   @ ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:62 [inlined]
 [7] contract
   @ ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:52 [inlined]
 [8] contract(labels_dest::Tuple{Int64}, a1::Vector{Float64}, labels1::Tuple{Int64}, a2::Array{Float64, 0}, labels2::Tuple{})
   @ TensorAlgebra ~/Documents/itensor/TensorAlgebra.jl/src/contract/contract.jl:52
 [9] top-level scope
   @ REPL[16]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions