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

11
LINES

< > BotCompany Repo | #1032705 // AdaptiveAverage ["cooling" average/"aging" average] - running average that gets progressively less sensitive

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (50L/1K).

sclass AdaptiveAverage {
  double divisor = 1, value, coolDownSpeed = .5;
  
  void add(double d) {
    value = blend(value, d, 1/divisor);
    divisor += coolDownSpeed;
  }

  double get() { ret value; }
  double age() { ret divisor; }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1032705
Snippet name: AdaptiveAverage ["cooling" average/"aging" average] - running average that gets progressively less sensitive
Eternal ID of this version: #1032705/8
Text MD5: b4a789e04d4990af55f1cab6c65089d0
Transpilation MD5: 3307b8186999aeffca220663a00ab7da
Author: stefan
Category: javax / maths
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-02 05:38:20
Source code size: 248 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 108 / 512
Version history: 7 change(s)
Referenced in: [show references]