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

9
LINES

< > BotCompany Repo | #1033112 // ArrayMatrix - simple array-based implementation of Matrix

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

Libraryless. Click here for Pure Java version (5412L/30K).

persistable sclass ArrayMatrix<A> extends AbstractMatrix<A> {
  A[] data;
  
  *(int *w, int *h) { data = (A[]) new O[w*h]; }
  *(int *w, int *h, A[] *data) {}

  public A get(int x, int y) { ret data[y*w+x]; }
  public void set(int x, int y, A a) { data[y*w+x] = a; }
}

Author comment

Began life as a copy of #1033111

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033112
Snippet name: ArrayMatrix - simple array-based implementation of Matrix
Eternal ID of this version: #1033112/4
Text MD5: f7d61c0e4a4cd02c4a890af958170586
Transpilation MD5: 5601cf35883c56d189dd291f601c7fd9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-04 03:43:50
Source code size: 278 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 302
Version history: 3 change(s)
Referenced in: #1033119 - AbstractMatrix
#1033581 - BitSetMatrix - simple BitSet-based implementation of BitMatrix
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)
#1035234 - BlockOptimizedIntMatrix - Matrix<Int> stored in blocks of a fixed size (very compact if an entire block is one value, gracefully degrades otherwise)