Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1031941 // localMaximaIncludingPlateaus

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2986L/17K).

static L<Int> localMaximaIncludingPlateaus(double[] l) {
  ret localMaximaIncludingPlateaus(l, 0, l(l));
}

static L<Int> localMaximaIncludingPlateaus(double[] l, int from, int to) {
  new L<Int> out;
  int n = l(l);
  for (int i = from; i < to; i++)
    if ((i == from || l[i] >= l[i-1])
      && (i == to-1 || l[i] >= l[i+1]))
      out.add(i);
  ret out;
}

Author comment

Began life as a copy of #1025236

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031941
Snippet name: localMaximaIncludingPlateaus
Eternal ID of this version: #1031941/2
Text MD5: 48f2969ae47d3ce9b3c18e1ae5ca7bac
Transpilation MD5: 2d397fe13a8b46f6ef9522d17228eb0e
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-03 17:21:46
Source code size: 371 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 148 / 219
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)