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

Function logspace

src/utilities/data/Vector.cpp:240–249  ·  view source on GitHub ↗

generates a Vector of N points logarithmically spaced between and including base^a and base^b.

Source from the content-addressed store, hash-verified

238
239/// generates a Vector of N points logarithmically spaced between and including base^a and base^b.
240Vector logspace(double a, double b, unsigned N, double base) {
241 Vector powers = linspace(a, b, N);
242
243 Vector result(N);
244 for (unsigned n = 0; n < N; ++n) {
245 result(n) = std::pow(base, powers(n));
246 }
247
248 return result;
249}
250
251/// take the natural logarithm of elements of a Vector
252Vector log(const Vector& x) {

Callers 1

TESTFunction · 0.85

Calls 2

linspaceFunction · 0.85
powFunction · 0.50

Tested by 1

TESTFunction · 0.68