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

How to import your OMP function #8

Closed
WillPowellUk opened this issue Nov 1, 2023 · 2 comments
Closed

How to import your OMP function #8

WillPowellUk opened this issue Nov 1, 2023 · 2 comments

Comments

@WillPowellUk
Copy link

Hi Sebastian,

I am struggling to import your code so that I can run your omp function.

I am sure there will be a more elegant solution but as of now I have included all the files locally, and then tried to run omp:

`include("CompressedSensing.jl-main/src/matchingpursuit.jl")
include("CompressedSensing.jl-main/src/util.jl")
include("CompressedSensing.jl-main/src/backward.jl")
include("CompressedSensing.jl-main/src/basispursuit.jl")
include("CompressedSensing.jl-main/src/exhaustive.jl")
include("CompressedSensing.jl-main/src/forward.jl")
include("CompressedSensing.jl-main/src/matchingpursuit.jl")
include("CompressedSensing.jl-main/src/oblivious.jl")
include("CompressedSensing.jl-main/src/sbl.jl")
include("CompressedSensing.jl-main/src/stepwise.jl")
include("CompressedSensing.jl-main/src/twostage.jl")
include("CompressedSensing.jl-main/src/CompressedSensing.jl")

omp(A, b, k)
However I am getting the erorLoadError: UndefVarError: SparseVector not defined` which I assume is a dependency from a file that is included later.

I apologies for my ineptidue in Julia but please advise.

Kind regards,
Will

@SebastianAment
Copy link
Owner

Good question @WillPowellUk!

Did you try adding CompressedSensing to the package manager?

In the REPL (i.e. terminal), you can do this by first typing "]", which should change the context from "julia>" to pkg>. You can then type add CompressedSensing and hit enter:

julia>]
(@v1.9) pkg> add CompressedSensing

This should install all the required dependencies and might take a few minutes. After that is done, press "delete" to exit the package manager. You should see "julia>" again on the left in your terminal.

Now the final step:

julia> import CompressedSensing: omp

julia> A = randn(3, 4); b = randn(3);

julia> omp(A, b, sparsity=2)
4-element SparseArrays.SparseVector{Float64, Int64} with 2 stored entries:
  [1]  =  0.856756
  [2]  =  0.0834363

I apologize for the lack of clear documentation. This grew out of a grad school project of mine. If the above resolves your issue, I'll add it to the README.

@WillPowellUk
Copy link
Author

@SebastianAment Thank you ever so much. Your instructions are very clear, and worked like a charm. I really appreciate you open sourcing this. Do add to the ReadMe to help others. Cheers!

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