vendredi 6 mars 2020

Combine the ratios of two different vectors in c++

I don't know how to explain it so it if this question exists, just point me to the right topic. I have searched the forum but couldn't find any answer (maybe there is a keyword in mathematics or statistics for this that I am missing).

How do I produce a vector with combined weights from two vectors?

For example given two vectors:

vector_1 = {3, 3, 4}
vector_2 = {5, 5}

We calculate their weights which is the element divided by the sum of the elements in the vector.

weights_1 = {0.3, 0.3, 0.4}
weights_2 = {0.5, 0.5}

These are then combined to produce this vector:

combined_weights = {0.3, 0.2, 0.1, 0.4}

The combined weights is the combined ratio of the two vectors.

My goal is to make vector_1 and vector_2 have similar size.

vector_1 = {3, 2, 1, 4}
vector_3 = {3, 2, 1, 4}

Aucun commentaire:

Enregistrer un commentaire