-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
I tried to use SparseArrayKit with TensorOperations, but when I attempt to do a contraction, I get this error:
ERROR: LoadError: MethodError: no method matching Strided.UnsafeStridedView(::SparseArray{Float64, 3})
Closest candidates are:
Strided.UnsafeStridedView(::PermutedDimsArray{T, N, P}) where {T, N, P} at ~/.julia/packages/Strided/pDrSx/src/unsafestridedview.jl:27
Strided.UnsafeStridedView(::Base.ReshapedArray) at ~/.julia/packages/Strided/pDrSx/src/unsafestridedview.jl:26
Strided.UnsafeStridedView(::SubArray) at ~/.julia/packages/Strided/pDrSx/src/unsafestridedview.jl:25
Full Stacktrace:
Stacktrace:
[1] isblascontractable(A::SparseArray{Float64, 3}, p1::Tuple{Int64, Int64}, p2::Tuple{Int64}, C::Symbol)
@ TensorOperations ~/.julia/packages/TensorOperations/LDxfx/src/implementation/stridedarray.jl:332
[2] contract!(α::Bool, A::SparseArray{Float64, 3}, CA::Symbol, B::Vector{Float64}, CB::Symbol, β::Bool, C::Matrix{Float64}, oindA::Tuple{Int64, Int64}, cindA::Tuple{Int64}, oindB::Tuple{}, cindB::Tuple{Int64}, indCinoAB::Tuple{Int64, Int64}, syms::Tuple{Symbol, Symbol, Symbol})
@ TensorOperations ~/.julia/packages/TensorOperations/LDxfx/src/implementation/stridedarray.jl:230
[3] contract!(α::Bool, A::SparseArray{Float64, 3}, CA::Symbol, B::Vector{Float64}, CB::Symbol, β::Bool, C::Matrix{Float64}, oindA::Tuple{Int64, Int64}, cindA::Tuple{Int64}, oindB::Tuple{}, cindB::Tuple{Int64}, indleft::Tuple{Int64, Int64}, indright::Tuple{}, syms::Tuple{Symbol, Symbol, Symbol})
@ TensorOperations ~/.julia/packages/TensorOperations/LDxfx/src/implementation/stridedarray.jl:89
[4] test_contraction(A::SparseArray{Float64, 3}, b::Vector{Float64})
@ Main ~/Documents/projects/volumeTransform/volumeTransform/scripts/sparsearray_test.jl:14
[5] top-level scope
@ ~/Documents/projects/volumeTransform/volumeTransform/scripts/sparsearray_test.jl:24
in expression starting at ~/Documents/projects/volumeTransform/volumeTransform/scripts/sparsearray_test.jl:24
Here is the minimal example:
using SparseArrayKit
using TensorOperations
function make_sparse_tensor()
A = SparseArray{Float64}(undef, Tuple([10, 10, 10]))
for i in 1:10
A[CartesianIndex(i,i,i)] = i
end
return A
end
function test_contraction(A, b)
@tensor begin
res[i,j] := A[i, j, k] * b[k]
end
return res
end
A = make_sparse_tensor()
b = randn(10)
test_contraction(A, b)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels