(shape: number[])
| 563 | } |
| 564 | |
| 565 | export function computeStrides(shape: number[]): number[] { |
| 566 | const rank = shape.length; |
| 567 | if (rank < 2) { |
| 568 | return []; |
| 569 | } |
| 570 | |
| 571 | // Last dimension has implicit stride of 1, thus having D-1 (instead of D) |
| 572 | // strides. |
| 573 | const strides = new Array(rank - 1); |
| 574 | strides[rank - 2] = shape[rank - 1]; |
| 575 | for (let i = rank - 3; i >= 0; --i) { |
| 576 | strides[i] = strides[i + 1] * shape[i + 1]; |
| 577 | } |
| 578 | return strides; |
| 579 | } |
| 580 | |
| 581 | function createNestedArray( |
| 582 | offset: number, shape: number[], a: TypedArray, isComplex = false) { |
no outgoing calls
no test coverage detected
searching dependent graphs…