Non-trivial conversions (Python to Julia)

Greetings Watchers,

Disclaimer: Please maintain some level
of professionalism/community by attempting
to share your general thought process, feel
free to follow-up with me for clarification or
simply scroll/click along if you are neither
interested nor able to spend a little time
sharing your thoughts. Spare us the lectures
about MWEs, they are useful tools but not a
catchall especially for high-level or theoretical
questions. However, if you could provide one
that is instructive – it may benefit all.

I am attempting to convert two non-trivial
functions from Python to Julia:


The first function replaces boolean
variable inputs (0,1) within quadratic
functions with spin variable inputs
(-1,1). The second function does the

Are there any among you who might be
able to share your general thought or
process for converting these functions
from Python to Julia? Otherwise, if you
could point us to some resources that
explain the rudiments, this could benefit
all those watching.


Nah. I think this is a low effort question that doesn’t respect the time or efforts of the people on this forum answering questions, and it seems you’ve actually put less effort into your question than you put into trying to dissuade people like me from asking you to phrase your question in a more productive way.

While MWE’s are fantastic tools, you are right they’re not the only way to approach questions. However, putting no effort into even linking to the relevant package, or explaining what these functions do, and not demonstrating any effort on your part to understand how you could have done this yourself and then outlining where you ran into trouble, I think is a bad thing and posts like this should not be encouraged.


Write unit tests in Python, translate them to Julia, fix the issues they show in Julia. Just did that over Easter…


for the other readers:
as I see - the python implementations is quso_to_qubo

@ufechner7 – This is exactly what I was looking for.
Such a simple answer, that allows me to build from the
rudiments. Thank you!


Thank you for your insights. I believe your
intention was to help. You will notice that
two high-level responses were provided
from those who seem more familiar with
the topic which were the guidelines I was
looking for – with no MWEs nonetheless.

It seems to me the user has been around for some time here and I’ll assume he has a very bad day. But this

is either a translation problem of a non native speaker or inappropriate (correct me if I’m wrong).

There might have been some communication issues, but I like the answer marked as solution, it also helps me to use an improved approach in the future.


@goerch – Not a translation or non-native English
speaker problem. The entire statement was directed
to @Eben60, the contributor who provided the fullest
solution/thought process without incident.

Yes – perhaps the other user, was a little upset about
something else. But I appreciated the time he spent
sharing his opinions.


I’m not a native speaker, but in my understanding your comment seems to dispute the abilities of readers of this group and this I don’t like very much.

@goerch – That was NOT my intention.
Your question or post read as if, you were
saying that I incorrectly heralded the
person who provided the most comprehensive
thought process.

Also, I do not know anyone who would reply to
my posts. My assumption is that those who
contribute can provide overarching direction,
a MWE (if appropriate), or ask for clarification.

1 Like

On a related issue, if you are interested in the reformulation of optimization problems into QUBO, you should check our package toQUBO.jl where we have implemented the transformation of binaries to spins and many more things. Feel free to leave any comments regarding your use case and we can talk about that more in depth. Moreover, if you want to contribute to it, we can always use more hand :slight_smile:

1 Like

This was very helpful! I appreciate that you
were not deterred by the disclaimer.

Thank you – I will continue the
stream there. I actually reached
out to the members previously for
a closed issue.