MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / linspace

Function linspace

src/utilities/data/Vector.cpp:216–225  ·  view source on GitHub ↗

generates a Vector of N points linearly spaced between and including a and b.

Source from the content-addressed store, hash-verified

214
215/// generates a Vector of N points linearly spaced between and including a and b.
216Vector 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.
228Vector deltaSpace(double a, double b, double delta) {

Callers 7

referencePointsMethod · 0.85
TEST_FFunction · 0.85
logspaceFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 5

TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TESTFunction · 0.68