MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / dsFiniteEnds

Function dsFiniteEnds

app/src/DSP.h:900–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898 */
899template<typename XAt, typename YAt>
900[[nodiscard]] inline bool dsFiniteEnds(
901 std::size_t n, XAt xAt, YAt yAt, std::size_t& first, std::size_t& last)
902{
903 first = n;
904 for (std::size_t i = 0; i < n; ++i) {
905 if (std::isfinite(xAt(i)) && std::isfinite(yAt(i))) {
906 first = i;
907 break;
908 }
909 }
910
911 if (first == n)
912 return false;
913
914 last = first;
915 for (std::size_t i = n; i > first; --i) {
916 if (std::isfinite(xAt(i - 1)) && std::isfinite(yAt(i - 1))) {
917 last = i - 1;
918 break;
919 }
920 }
921
922 return true;
923}
924
925/**
926 * @brief Extracts the global Y bounds from the filled workspace columns (O(columns),

Callers 1

downsampleMonotonicFunction · 0.85

Calls 1

isfiniteFunction · 0.85

Tested by

no test coverage detected