This function subtracts the elements of vector b from the elements of vector a, a0i = ai ?�� bi. The two vectors must have the same length.
| 585 | //This function subtracts the elements of vector b from the elements of vector a, a0i = |
| 586 | //ai ?�� bi. The two vectors must have the same length. |
| 587 | void vector_sub (std::vector<float>& a, const std::vector<float>& b) { |
| 588 | if (a.size() != b.size()) { |
| 589 | cout << "Error: The two vectors must have the same length\n"; |
| 590 | return; |
| 591 | } |
| 592 | for (int i = 0; i < (int)a.size(); i++) { |
| 593 | a[i] -= b[i]; |
| 594 | } |
| 595 | } |
| 596 | //This function multiplies the elements of vector a by the constant factor x, a0i = xai. |
| 597 | void vector_scale(std::vector<float>& a, float const b) { |
| 598 | for (int i = 0; i < (int)a.size(); i++) { |
no outgoing calls
no test coverage detected