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).

1  
static L<Int> localMaximaIncludingPlateaus(double[] l) {
2  
  ret localMaximaIncludingPlateaus(l, 0, l(l));
3  
}
4  
5  
static L<Int> localMaximaIncludingPlateaus(double[] l, int from, int to) {
6  
  new L<Int> out;
7  
  int n = l(l);
8  
  for (int i = from; i < to; i++)
9  
    if ((i == from || l[i] >= l[i-1])
10  
      && (i == to-1 || l[i] >= l[i+1]))
11  
      out.add(i);
12  
  ret out;
13  
}

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: 91 / 138
Version history: 1 change(s)
Referenced in: [show references]