QuantEcon / QuantEcon/BasisMatrices.jl
Sparse matrix problem when trying to creating a `BasisMatrix` object
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 33
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Argument error:illegal buffers for sparsematrixcsc when creating a BasisMatrix object
julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65e (2023-01-08 06:45 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 8 × Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 1 on 8 virtual cores
Environment:
JULIA_PKG_SERVER = https://mirrors.bfsu.edu.cn/julia
JULIA_EDITOR = code
JULIA_NUM_THREADS =
When trying to replicate the example in the demo example, I got
`ArgumentError: Illegal buffers for SparseMatrixCSC construction 270
Stacktrace:
[1] SparseMatrixCSC
@ C:\Users\lenovo\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\SparseArrays\src\sparsematrix.jl:29 [inlined]
[2] SparseArrays.SparseMatrixCSC(m::Int64, n::Int64, colptr::Vector{Int64}, rowval::Vector{Int64}, nzval::Vector{Float64})
@ SparseArrays C:\Users\lenovo\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\SparseArrays\src\sparsematrix.jl:44
[3] _allocate_row_kron_out(#unused#::Type{SparseArrays.SparseMatrixCSC}, A::Matrix{Float64}, B::SparseArrays.SparseMatrixCSC{Float64, Int64})
@ BasisMatrices C:\Users\lenovo.julia\packages\BasisMatrices\PZ1uM\src\util.jl:625
[4] _allocate_row_kron_out
@ C:\Users\lenovo.julia\packages\BasisMatrices\PZ1uM\src\util.jl:643 [inlined]
[5] row_kron(A::Matrix{Float64}, B::SparseArrays.SparseMatrixCSC{Float64, Int64})
@ BasisMatrices C:\Users\lenovo.julia\packages\BasisMatrices\PZ1uM\src\util.jl:33
[6] convert(::Type{Expanded}, bs::BasisMatrix{Direct, AbstractMatrix{Float64}}, order::Matrix{Int64})
@ BasisMatrices C:\Users\lenovo.julia\packages\BasisMatrices\PZ1uM\src\basis_structure.jl:149
[7] BasisMatrix
@ C:\Users\lenovo.julia\packages\BasisMatrices\PZ1uM\src\basis_structure.jl:246 [inlined]
[8] BasisMatrix(basis::Basis{2, Tuple{SplineParams{Vector{Float64}}, ChebParams{Float64}}}, tbm::Expanded, x::Matrix{Float64}, order::Int64)
@ BasisMatrices C:\Users\lenovo.julia\packages\BasisMatrices\PZ1uM\src\basis_structure.jl:304
[9] top-level scope
@ c:\Users\lenovo\Documents\Julia\NumericalMethods\jupyter-notebooks\BasisMatrices_demo.ipynb:1
UndefVarError: Φ not defined
Stacktrace:
[1] top-level scope
@ c:\Users\lenovo\Documents\Julia\NumericalMethods\jupyter-notebooks\BasisMatrices_demo.ipynb:6
UndefVarError: c not defined
Stacktrace:
[1] top-level scope
@ c:\Users\lenovo\Documents\Julia\NumericalMethods\jupyter-notebooks\BasisMatrices_demo.ipynb:7`
How could I fix this problem, Thank you.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing BasisMatrix construction in jupyter-notebooks/BasisMatrices_demo.ipynb and trace the stack into src/util.jl at lines 625 and 643, then src/basis_structure.jl at lines 149 and 246. Reproduce the SparseMatrixCSC error on Julia 1.8.5 and determine what change is needed for the demo to construct the BasisMatrix without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100