I have the values of a matrix in a vector:
vector<int> values;
and I want to multiply this "matrix" by a vector, I tried this:
vector<float> Matrix::operator*(vector<float> vec) {
vector<float> c;
c.resize(vec.size());
int counter = 0;
float i = 0;
while (i <= float(m_valor.size() / vec.size())) {
for (int j = 0; j < vec.size(); j++) {
if (counter > m_valor.size() - 1) {
break;
}
c[j] = (m_valor[counter] * vec[j]) + c[j];
counter++;
}
i++;
}
return c;
}
But the result seems not correct
Aucun commentaire:
Enregistrer un commentaire