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

problems in reshaping full GBMatrix into vector #106

Closed
CarloLucibello opened this issue Nov 8, 2022 · 1 comment
Closed

problems in reshaping full GBMatrix into vector #106

CarloLucibello opened this issue Nov 8, 2022 · 1 comment

Comments

@CarloLucibello
Copy link

CarloLucibello commented Nov 8, 2022

julia> a = rand(2, 4) |> GBMatrix
2x4 GraphBLAS double matrix, full by col
  8 entries, memory: 272 bytes

    (1,1)    0.376955
    (2,1)    0.704176
    (1,2)    0.490282
    (2,2)    0.746083
    (1,3)    0.231588
    (2,3)    0.0124536
    (1,4)    0.914377
    (2,4)    0.124544


julia> reshape(a, :) # the result should be a vector, not a matrix
8x1 GraphBLAS double matrix, full by col
  8 entries, memory: 272 bytes

    (1,1)    0.376955
    (2,1)    0.704176
    (3,1)    0.490282
    (4,1)    0.746083
    (5,1)    0.231588
    (6,1)    0.0124536
    (7,1)    0.914377
    (8,1)    0.124544


julia> reshape(a, :) isa AbstractVector # this should give true
false

julia> reshape(a, 8)  # this should be equivalent to reshape(a, :)
ERROR: MethodError: reshape(::GBMatrix{Float64, Float64}, ::Int64) is ambiguous. Candidates:
  reshape(parent::AbstractArray, dims::Int64...) in Base at reshapedarray.jl:117
  reshape(parent::AbstractArray, dims::Union{Int64, AbstractUnitRange}...) in Base at reshapedarray.jl:110
  reshape(A::SuiteSparseGraphBLAS.AbstractGBArray{T, F, O, 2} where {T, F, O}, n::Union{Colon, Int64}; bycol) in SuiteSparseGraphBLAS at /Users/carlo/.julia/packages/SuiteSparseGraphBLAS/hotIr/src/abstractgbarray.jl:240
Possible fix, define
  reshape(::SuiteSparseGraphBLAS.AbstractGBArray{T, F, O, 2} where {T, F, O}, ::Int64)
Stacktrace:
 [1] top-level scope
   @ REPL[147]:1
@rayegun
Copy link
Member

rayegun commented Sep 11, 2023

This was fixed at some point, not sure when but is working on master.

@rayegun rayegun closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants