Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cxx.jl converting between Julia Complex and std::complex

Tags:

c++

julia

I'm currently using Cxx to allow Julia code to interact with a C++ library. Part of what I want to do is to efficiently pass collections (typically vectors) of complex data in both directions. That is, I'd like something along the lines of:

cv = [1 + 2im, 0 - 1im, ..., 1 + 0im]
cxxv = convert(cxxt"std::vector<std::complex<int>>", cv)
new_cv = icxx"process_complex_vector($cxxv);"
# do some stuff with new_cv

Any suggestions?

like image 645
user888379 Avatar asked Jun 29 '26 13:06

user888379


1 Answers

My impression is that Cxx.jl is not well maintained and that if you're serious about wrapping a C++ lib, you should use CxxWrap.jl. I tried to use Cxx to wrap a library and gave up. Your results may vary.

That said, it may be that Keno would respond better on the Julia slack.

like image 97
Bengt Jonsson Avatar answered Jul 01 '26 03:07

Bengt Jonsson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!