Skip to content

Convert to sparse #204

@edljk

Description

@edljk

Is there a way to convert a PyObject containing a sparse matrix to a Julia sparse Matrix type ?

@pyimport scipy.sparse as sp
Id = sp.eye(4)
Idj = convert(SparseMatrixCSC{Float64,Int64},Id)


ERROR: MethodError: `convert` has no method matching convert(::Type{SparseMatrixCSC{Float64,Int64}}, ::PyCall.PyObject)
This may have arisen from a call to the constructor SparseMatrixCSC{Float64,Int64}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert{Tv,Ti,TvS,TiS}(::Type{SparseMatrixCSC{Tv,Ti}}, ::SparseMatrixCSC{TvS,TiS})
  convert{Tv}(::Type{SparseMatrixCSC{Tv,Int64}}, ::Base.SparseMatrix.CHOLMOD.Sparse{Tv})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions