generates a Vector of N points linearly spaced between and including a and b.
| 214 | |
| 215 | /// generates a Vector of N points linearly spaced between and including a and b. |
| 216 | Vector linspace(double a, double b, unsigned N) { |
| 217 | double delta = (b - a) / (N - 1); |
| 218 | |
| 219 | Vector result(N); |
| 220 | for (unsigned n = 0; n < N; ++n) { |
| 221 | result(n) = a + n * delta; |
| 222 | } |
| 223 | |
| 224 | return result; |
| 225 | } |
| 226 | |
| 227 | /// generates a Vector linearly spaced points starting at a and ending before or at b with interval delta. |
| 228 | Vector deltaSpace(double a, double b, double delta) { |