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

[BUG] contract fails for zerodim input #16

Closed
ogauthe opened this issue Jan 15, 2025 · 1 comment · Fixed by #18
Closed

[BUG] contract fails for zerodim input #16

ogauthe opened this issue Jan 15, 2025 · 1 comment · Fixed by #18
Labels
bug Something isn't working

Comments

@ogauthe
Copy link
Contributor

ogauthe commented Jan 15, 2025

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.
@ogauthe ogauthe added the bug Something isn't working label Jan 15, 2025
@mtfishman
Copy link
Member

Thanks for the report, that should be easy to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants