Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
453 stars 56 forks source link

Errors with non-BLAS-type arrays #49

Closed amilsted closed 5 years ago

amilsted commented 6 years ago

Hi Jutho, I'm seeing the following issue with 0.7.0 and TensorOps master:

a = [1;2;3]
b = [2 3 4; 5 6 7]
@tensor res[j] := b[j,i] * a[i]

results in

ERROR: MethodError: no method matching iterate(::Type{Val{:BLAS}})
Closest candidates are:
  iterate(::Any) at essentials.jl:853
  iterate(::Any, ::Any) at essentials.jl:847
  iterate(::Core.SimpleVector) at essentials.jl:583
  ...
Stacktrace:
 [1] start(::Type{Val{:BLAS}}) at ./essentials.jl:878
 [2] iterate(::Type) at ./essentials.jl:853
 [3] append_any(::Tuple{Int64}, ::Vararg{Any,N} where N) at ./essentials.jl:420
 [4] contract!(::Int64, ::Array{Int64,2}, ::Type{Val{:N}}, ::Array{Int64,1}, ::Type{Val{:N}}, ::Int64, ::Array{Int64,1}, ::Tuple{Int64}, ::Tuple{Int64}, ::Tuple{}, ::Tuple{Int64}, ::Tuple{Int64}, ::Type, ::Type{Val{:BLAS}}) at /home/amilsted/.julia/packages/TensorOperations/2n9c6/src/implementation/stridedarray.jl:88 (repeats 4 times)
 [5] top-level scope at /home/amilsted/.julia/packages/TensorOperations/2n9c6/src/indexnotation/tensormacro.jl:447

The above works fine with Float arrays, but fails with integers, rationals, etc.

Jutho commented 5 years ago

This is fixed with v1.0, which was just merged.