| 88 | } |
| 89 | |
| 90 | void ODEVector::weightedAddInplace(real weight, const ODEVector& rhs) { |
| 91 | if (weight == 0.0) { |
| 92 | return; |
| 93 | } |
| 94 | for (std::size_t i = 0; i < storages.size(); ++i) { |
| 95 | assert(sizes[i] == rhs.sizes[i]); |
| 96 | #pragma omp simd |
| 97 | for (std::size_t j = 0; j < sizes[i]; ++j) { |
| 98 | storages[i][j] += weight * rhs.storages[i][j]; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | real ODEVector::normDifferenceTo(ODEVector& other, bool useLInfNorm) { |
| 104 | // Computes the L2 or LInf norm of the difference between two vectors. |