(m)
| 160 | * @throws {Error} |
| 161 | */ |
| 162 | export const t = (m) => { |
| 163 | validate2D(m); |
| 164 | const mShape = shape(m); |
| 165 | const transposed = zeros([mShape[1], mShape[0]]); |
| 166 | for (let row = 0; row < m.length; row += 1) { |
| 167 | for (let col = 0; col < m[0].length; col += 1) { |
| 168 | transposed[col][row] = m[row][col]; |
| 169 | } |
| 170 | } |
| 171 | return transposed; |
| 172 | }; |
| 173 | |
| 174 | /** |
| 175 | * Traverses the matrix. |
nothing calls this directly
no test coverage detected