I'm here because there are some benchmarks I want to make use of that are written in Julia

Hello!

I’m brand new to Julia, and I’m an extremely inexperienced coder overall. I am working on an undergraduate research project and it includes some coding that we used Python for, nothing too fancy just a few scipy, numpy, a function from fftpack (the discreet cosine transform) and the pyplot packages. Our code is only about 150 lines.

We’re specifically studying non-linear eigenvalue problems, and we’re at a point where it would be really great for us to be able to generate non-linear eigenvalue problems, as well as be able to benchmark them. It just so happens that such a package exists on github: nep-pack.

Notice that this package is in Julia?

Okay, so here’s my question: what is the easiest way for me to make use this package?

So, it’s only 150 lines of code, I could re-write the algorithm in Julia, and I would have learned something cool.

However, my understanding is there is a way to use python packages in Julia and vice-versa…
Specifically, if I’m working in PyCharm, is it possible to download this nep-pack and install it as a plugin, then call it in my Python file? If someone knows how to do this and is willing to provide a step-by-step, it would be appreciated.

I suspect that the other way around would not be easier, but if it is, I managed to get Juno running.

Anyway, thanks for taking the time to offer your guidance, I’ll be sure to follow up with the post when I’ve made some progress!

edit:
There’s a thread about getting Julia to work with with PyCharm… seems hit and miss: Pycharm with Julia 1.0?

2 Likes

Have a look here:

Calling Julia from Python GitHub - JuliaPy/pyjulia: python interface to julia

Calling Python from Julia https://github.com/JuliaPy/PyCall.jl

2 Likes

If you want to try writing it in Julia and need help, this is also a great place to ask. As a bonus, if you get an implementation of it in Julia that’s slower than your python version, and post a thread about how Julia is slower than python, odds are, you’ll attract at least 10 different people here to show you how to make it 100x faster (this is only partly a joke. Sometimes the observed speedups are much more than 100x)

13 Likes

While I appreciate your suggestion, I was hoping for something a bit more specific than this.

Specifically, I’m using PyCharm. How do I get pyjulia installed on PyCharm? Why not just use the package that’s available from PyCharm (which I don’t seem able to get working)?

Thanks

1 Like

My goal is just to avoid guesswork as much as I can. I’m anticipating that this would be the easier solution. Thanks

It looks as if PyCharm uses Pip by default. Can you try to follow the PyJulia installation instructions? You’ll probably want to complete Step 2 from PyCharm’s package manager GUI.

My experience was: If you want to call Julia functions from Python, and you can avoid it - better avoid it. Especially as a beginner. Among other things, debugging the mixed-language software was a nightmare. Surely, in this way you learn a lot of Julia, but there must be more pleasant and productive ways to learn it.

The best thing would be to have everything in Julia, of course. At 150 LOC it is probably the most practical way. However calling Python functions from Julia worked better, so having your main program in Julia and calling your Python code could be a viable alternative.

3 Likes

So I’m undertaking the task of re-writing the code in Julia. I will post another question regarding the use of a discrete cosine transform.

Thanks!

2 Likes

https://nep-pack.github.io/NonlinearEigenproblems.jl/tutorial_call_python/

1 Like