MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / linspace

Function linspace

source/matplot/util/common.cpp:68–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66 }
67
68 std::vector<double> linspace(double d1, double d2, size_t n) {
69 std::vector<double> x(n);
70 // avoid division by zero
71 double step = n > 1? (d2 - d1) / static_cast<double>(n - 1) : 0.;
72 for (size_t i = 0; i < x.size(); ++i) {
73 x[i] = d1 + static_cast<double>(i) * step;
74 }
75 return x;
76 }
77
78 std::vector<double> linspace(double d1, double d2) {
79 return linspace(d1, d2, 100);

Callers 15

fimplicitMethod · 0.85
polarhistogramMethod · 0.85
polarplotMethod · 0.85
fcontourMethod · 0.85
fmeshMethod · 0.85
fsurfMethod · 0.85
rectangleMethod · 0.85
ellipseMethod · 0.85
data_stringMethod · 0.85
bin_pickerMethod · 0.85
bin_pickerblFunction · 0.85
sqrt_ruleMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected