UNPKG
@sgratzl/science
Version:
latest (2.0.0)
2.0.0
Scientific and statistical computing in JavaScript.
github.com/sgratzl/science.js
sgratzl/science.js
@sgratzl/science
/
src
/
lin
/
transpose.js
13 lines
(12 loc)
•
252 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
export
default
function
transpose
(
a
) {
var
m = a.
length
, n = a[
0
].
length
, i = -
1
, j, b =
new
Array
(n);
while
(++i < n) { b[i] =
new
Array
(m); j = -
1
;
while
(++j < m) b[i][j] = a[j][i]; }
return
b; };