(
vals: TypedArray|string[], shape: number[], dtype: DataType,
strides: number[])
| 44 | } |
| 45 | |
| 46 | function computeMaxSizePerColumn( |
| 47 | vals: TypedArray|string[], shape: number[], dtype: DataType, |
| 48 | strides: number[]): number[] { |
| 49 | const n = sizeFromShape(shape); |
| 50 | const numCols = strides[strides.length - 1]; |
| 51 | const padPerCol = new Array(numCols).fill(0); |
| 52 | const rank = shape.length; |
| 53 | const valuesOrTuples = |
| 54 | dtype === 'complex64' ? createComplexTuples(vals) : vals; |
| 55 | |
| 56 | if (rank > 1) { |
| 57 | for (let row = 0; row < n / numCols; row++) { |
| 58 | const offset = row * numCols; |
| 59 | for (let j = 0; j < numCols; j++) { |
| 60 | padPerCol[j] = Math.max( |
| 61 | padPerCol[j], |
| 62 | valToString(valuesOrTuples[offset + j], 0, dtype).length); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | return padPerCol; |
| 67 | } |
| 68 | |
| 69 | function valToString( |
| 70 | val: number|string|[number, number], pad: number, dtype: DataType) { |
no test coverage detected
searching dependent graphs…