MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / vector_sub

Function vector_sub

src/myFunc.cpp:587–595  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
587void 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.
597void vector_scale(std::vector<float>& a, float const b) {
598 for (int i = 0; i < (int)a.size(); i++) {

Callers 1

findnextbreakpointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected