I am new to programming how can I solve this error could someone help me? tried it by myself but wasn't able to! I tried changing the variable data types but got other errors. Please suggest me what can I do to solve this error.
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <vector>
#include <complex>
#define assertm(exp, msg) assert(((void)msg, exp))
typedef std::vector<int> int_vector;
typedef double my_float;
typedef std::complex<my_float> my_complex;
typedef std::vector<my_complex> complex_vector;
typedef std::vector<my_float> float_vector;
typedef std::vector<int> int_vector;
typedef std::vector<complex_vector> complex_matrix;
typedef std::vector<int_vector> int_matrix;
void scaleVectorInplace(std::vector<my_complex>& V, my_complex scale){
std::transform(V.begin(), V.end(), V.begin(), [scale](auto s) { return s * scale; });
}
std::vector<my_complex> scaleVector(const std::vector<my_complex>& V, my_complex scale) {
std::vector<my_complex> result = V;
scaleVectorInplace(result, scale);
return result;
}
my_complex qpskmod(int symbol) {
const std::vector<my_complex> mapping {{1,1}, {-1,1}, {1,-1}, {-1, -1}};
return mapping[symbol];
}
int main() {
int symbol;
// Modulate one symbol to its QPSK representation
const complex_vector mapping {{1,1}, {-1,1}, {1,-1}, {-1, -1}};
int_vector symbols;
// Modulate a vector of symbols with is QPSK representation
std::vector<my_complex> result;
//complex_vector result;
result.resize(symbols.size());
// applies QPSK modulation to each symbol in the vector
std::transform(symbols.begin(), symbols.end(),
result.begin(), [](int s) { return qpskmod(s); });
return result;
}
Error:
In function 'int main()':
55:10: error: cannot convert 'std::vector<std::complex<double> >' to 'int' in return