Closed andreyz4k closed 2 years ago
It's quite uncomfortable since extracting A[:, i] outputs a matrix, but reduce with fixed dims outputs a vector. It's possible to transpose a vector to transform it into a matrix, but requires additional operation
A[:, i]
reduce
dims
julia> B = GBVector([1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]) 7x1 GraphBLAS int64_t matrix, full by col 7 entries, memory: 264 bytes (1,1) 1 (2,1) 2 (3,1) 3 (4,1) 4 (5,1) 5 (6,1) 6 (7,1) 7 julia> A = GBMatrix([1,1,2,2,3,4,4,5,6,7,7,7], [2,4,5,7,6,1,3,6,3,3,4,5], [1:12...]) 7x7 GraphBLAS int64_t matrix, bitmap by row 12 entries, memory: 649 bytes (1,2) 1 (1,4) 2 (2,5) 3 (2,7) 4 (3,6) 5 (4,1) 6 (4,3) 7 (5,6) 8 (6,3) 9 (7,3) 10 (7,4) 11 (7,5) 12 julia> A[:, 2] 7x1 GraphBLAS int64_t matrix, bitmap by col 1 entry, memory: 272 bytes (1,1) 1 julia> emul(A[:, 2], B) ERROR: DimensionMismatch("") Stacktrace: [1] emul!(C::GBMatrix{Int64, Nothing}, A::GBMatrix{Int64, Nothing}, B::GBVector{Int64, Nothing}, op::Function; mask::Nothing, accum::Nothing, desc::Nothing) @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/5AOj3/src/operations/ewise.jl:35 [2] emul(A::GBMatrix{Int64, Nothing}, B::GBVector{Int64, Nothing}, op::Function; mask::Nothing, accum::Nothing, desc::Nothing) @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/5AOj3/src/operations/ewise.jl:80 [3] emul(A::GBMatrix{Int64, Nothing}, B::GBVector{Int64, Nothing}, op::Function) (repeats 2 times) @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/5AOj3/src/operations/ewise.jl:78 [4] top-level scope @ REPL[58]:1 julia> emul(A[:, 2]', B') 1x7 GraphBLAS int64_t matrix, bitmap by row 1 entry, memory: 272 bytes (1,1) 1
It's quite uncomfortable since extracting
A[:, i]
outputs a matrix, butreduce
with fixeddims
outputs a vector. It's possible to transpose a vector to transform it into a matrix, but requires additional operation