Closed genGoblin closed 4 years ago
Hi, you have to use the same numeric type for the vector or do a conversion manually. You have std::complex
and complex
(kfr::complex
). This is different but fully compatible types . Use reinterpret_cast
to convert the pointer to proper type.
I am trying to do the following:
kfr::complex<float> *iQKFR = reinterpret_cast<kfr::complex<float>*>(&iQ);
size_t iqSize = sizeof(iQKFR);
univector<kfr::complex<float>> iq = make_univector(iQKFR, iQ.size());
std::cout << iq[0] << std::endl;
I want to see the first element in iq to make sure it is what I expect it to be. When I do the cout I get compiler error " error: invalid operands to binary expression ". What am I doing wronG?
size_t iqSize = sizeof(iQKFR);
This code retrieves size of the pointer, not the data and gives wrong results if iqSize
is used somewhere.
Try to change the last line to
println(iq[0]);
because std::cout
does not support printing complex numbers. println
is KFR function and does support complex numbers.
More details about your compiler output (full text of the error) would help to identify problem much quicker.
Reopen if still actual.
i have a "std::vector<std::complex> samples;"
I want to convert this to a univector but when I do "univector<complex> temp = make_univector(&samples.front(), samples.size());"
i get an error stating no viable conversion type. What would be the best way to convert my complex vector to the univector?