MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / plot_linspace

Function plot_linspace

plot/plot.c:1829–1848  ·  view source on GitHub ↗

* @brief Fill @p out with @p n linearly spaced values between @p start * and @p end (inclusive at both ends). * * Equivalent to NumPy's `linspace(start, end, n)`: the resulting array * has @c out[0] == start and @c out[n-1] == end (modulo float * rounding), with the remaining @p n-2 values evenly distributed * between them. Special-cased: * - @p n == 0 -> rejected, returns false.

Source from the content-addressed store, hash-verified

1827 }
1828
1829 const PlotSeries* s = &plot->series[index];
1830 if (s->dataSize == 0) {
1831 PLOT_LOG("[plot_series_max]: empty series -> false");
1832 return false;
1833 }
1834
1835 float m = s->yData[0];
1836 for (size_t i = 1; i < s->dataSize; ++i) {
1837 if (s->yData[i] > m) {
1838 m = s->yData[i];
1839 }
1840 }
1841
1842 *out = m;
1843 PLOT_LOG("[plot_series_max]: exit -> true (max=%g)", (double)m);
1844
1845 return true;
1846}
1847
1848
1849/**
1850 * @brief Sum of y values in the series at @p index.
1851 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected