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

33
LINES

< > BotCompany Repo | #1004570 // Column Predictors (include)

JavaX fragment (include)

1  
sclass RepeatColumn extends Predictor {
2  
  float[] nextColumn(float[] x) {
3  
    ret x;
4  
  }
5  
}
6  
7  
sclass ShiftDown extends Predictor {
8  
  float[] nextColumn(float[] f) {
9  
    if (f == null) null;
10  
    float[] g = copyColumn(f);
11  
    for (int i = 1; i < l(f); i++)
12  
      g[i] = f[i-1];
13  
    ret g;
14  
  }
15  
}
16  
17  
sclass LookLeft extends Predictor {
18  
  int width; // how far to look left
19  
  float[][] buf;
20  
  int x;
21  
  
22  
  float[] nextColumn(float[] f) {
23  
    if (f == null) null;
24  
    if (buf == null) buf = new float[width][];
25  
    
26  
    // exchange with data in rotating buffer
27  
    // (will return null until buffer is filled)
28  
    float[] g = buf[x];
29  
    buf[x] = f;
30  
    x = (x+1) % width;
31  
    ret g;
32  
  }
33  
}

Author comment

Began life as a copy of #1004567

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004570
Snippet name: Column Predictors (include)
Eternal ID of this version: #1004570/1
Text MD5: a1898e52a4bf930afda244cc985667a8
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-21 17:04:56
Source code size: 713 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 478 / 850
Referenced in: [show references]