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)

sclass RepeatColumn extends Predictor {
  float[] nextColumn(float[] x) {
    ret x;
  }
}

sclass ShiftDown extends Predictor {
  float[] nextColumn(float[] f) {
    if (f == null) null;
    float[] g = copyColumn(f);
    for (int i = 1; i < l(f); i++)
      g[i] = f[i-1];
    ret g;
  }
}

sclass LookLeft extends Predictor {
  int width; // how far to look left
  float[][] buf;
  int x;
  
  float[] nextColumn(float[] f) {
    if (f == null) null;
    if (buf == null) buf = new float[width][];
    
    // exchange with data in rotating buffer
    // (will return null until buffer is filled)
    float[] g = buf[x];
    buf[x] = f;
    x = (x+1) % width;
    ret g;
  }
}

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: 424 / 789
Referenced in: [show references]