Julia
中 Tensors.jl
调用 Vec
有个很奇怪的事情:
julia> using Tensors
julia> Vec{2}([1,3])
2-element Tensor{1,2,Int64,2}:
1
3
julia> Vec{2,Int}([1,3])
ERROR: MethodError: no method matching Tensor{1,2,Int64,2}(::Array{Int64,1})
Closest candidates are:
Tensor{1,2,Int64,2}(::Tuple{Vararg{T,N}} where T where N) where {order, dim, T, M} at /Users/yczhang/.julia/packages/Tensors/EOKLk/src/Tensors.jl:65
Tensor{1,2,Int64,2}(::Function) where {order, dim, T, M} at /Users/yczhang/.julia/packages/Tensors/EOKLk/src/Tensors.jl:66
Stacktrace:
[1] top-level scope at none:0
julia> Vec{2,Int}((1,3))
2-element Tensor{1,2,Int64,2}:
1
3