(index: number)
| 131 | } |
| 132 | |
| 133 | indexToLoc(index: number): number[] { |
| 134 | if (this.rank === 0) { |
| 135 | return []; |
| 136 | } else if (this.rank === 1) { |
| 137 | return [index]; |
| 138 | } |
| 139 | const locs: number[] = new Array(this.shape.length); |
| 140 | for (let i = 0; i < locs.length - 1; ++i) { |
| 141 | locs[i] = Math.floor(index / this.strides[i]); |
| 142 | index -= locs[i] * this.strides[i]; |
| 143 | } |
| 144 | locs[locs.length - 1] = index; |
| 145 | return locs; |
| 146 | } |
| 147 | |
| 148 | get rank() { |
| 149 | return this.shape.length; |
no test coverage detected