MCPcopy Create free account
hub / github.com/d3/d3-array / transpose

Function transpose

src/transpose.js:3–11  ·  view source on GitHub ↗
(matrix)

Source from the content-addressed store, hash-verified

1import min from "./min.js";
2
3export default function transpose(matrix) {
4 if (!(n = matrix.length)) return [];
5 for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) {
6 for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
7 row[j] = matrix[j][i];
8 }
9 }
10 return transpose;
11}
12
13function length(d) {
14 return d.length;

Callers 2

transpose-test.jsFile · 0.90
zipFunction · 0.85

Calls 1

minFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…