Skip to content

Conversation

@MartinuzziFrancesco
Copy link
Collaborator

@MartinuzziFrancesco MartinuzziFrancesco commented Feb 10, 2025

Closes #243

@MartinuzziFrancesco
Copy link
Collaborator Author

Actually I don't this is the correct approach. The sparse solution is returned even without using SparseArrays. However, SparseArrays is not in ReservoirComputing dependencies. I'm getting:

julia> @isdefined ReservoirComputing
true

julia> @isdefined SparseArrays
false

julia> weighted_init(100, 10)
100×10 Matrix{Float32}:
  0.0452399   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
 -0.0348047   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
 -0.0386004   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
  0.00981022  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
  0.0577838   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
 -0.0562827   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
  0.0441522   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
  0.0788491   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
  0.00627948  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
 -0.0293777   0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0
                                                    
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  -0.041219
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0975579
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  -0.0515611
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  -0.056383
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0956139
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0240148
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.0706484
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  -0.00635637
  0.0         0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   0.041213

julia> @isdefined SparseArrays
false

julia> weighted_init(100, 10; return_sparse=true)
100×10 SparseArrays.SparseMatrixCSC{Float32, Int64} with 100 stored entries:
⎡⡇⠀⠀⠀⎤
⎢⡇⠀⠀⠀⎥
⎢⢸⠀⠀⠀⎥
⎢⢸⠀⠀⠀⎥
⎢⠀⡇⠀⠀⎥
⎢⠀⡇⠀⠀⎥
⎢⠀⡇⠀⠀⎥
⎢⠀⡇⠀⠀⎥
⎢⠀⢸⠀⠀⎥
⎢⠀⢸⠀⠀⎥
⎢⠀⠀⡇⠀⎥
⎢⠀⠀⡇⠀⎥
⎢⠀⠀⢸⠀⎥
⎢⠀⠀⢸⠀⎥
⎢⠀⠀⢸⠀⎥
⎢⠀⠀⢸⠀⎥
⎢⠀⠀⠀⡇⎥
⎢⠀⠀⠀⡇⎥
⎢⠀⠀⠀⢸⎥
⎣⠀⠀⠀⢸⎦

julia> @isdefined SparseArrays
false

is this expected? or is there a better approach for it? @ChrisRackauckas

@MartinuzziFrancesco
Copy link
Collaborator Author

gente ping on this @ChrisRackauckas

@ChrisRackauckas
Copy link
Member

That means there's a dependency that still relies on sparsearrays

@MartinuzziFrancesco
Copy link
Collaborator Author

ah I see, StatsBase.jl seems to be the problem. We only use sample from that library, we should be able to go without it

@MartinuzziFrancesco MartinuzziFrancesco merged commit 36e44cf into master Feb 17, 2025
14 of 15 checks passed
@MartinuzziFrancesco MartinuzziFrancesco deleted the fm/sparse branch February 17, 2025 15:16
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

Successfully merging this pull request may close these issues.

Make use of SparseArrays.jl

3 participants