initial
This commit is contained in:
1 parent
5c0fd1b6fe
commit
244f492f9e
240 files changed
+65211
No files matched your search
@@ -0,0 +1,29 @@
|
||||
From [bennedich](https://discourse.julialang.org/t/love-in-245-characters-code-golf/20771)
|
||||
|
||||
```
|
||||
0:2e-3:2π .|>d->(P=
|
||||
fill(5<<11,64 ,25);z=8cis(
|
||||
d)sin(.46d);P[ 64,:].=10;for
|
||||
r=0:98,c=0 :5^3 x,y=@.mod(2-
|
||||
$reim((.016c-r/49im-1-im)z),
|
||||
4)-2;4-x^2>√2(y+.5-√√x^2)^
|
||||
2&&(P[c÷2+1,r÷4+1]|=Int(
|
||||
")*,h08H¨"[4&4c+1+r&
|
||||
3])-40)end;print(
|
||||
"\e[H\e[1;31m",
|
||||
join(Char.(
|
||||
P)))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
|
||||
[New York Times](https://www.nytimes.com/2019/02/14/science/math-algorithm-valentine.html)
|
||||
|
||||
Süss — German for “sweet” — is an interactive widget that allows you to tweak the algebra and customize the heart to your souls’s delight. It was created for Valentine’s Day by Imaginary, a nonprofit organization in Berlin that designs open-source mathematics programs and exhibitions.
|
||||
|
||||
You can stretch and squeeze the heart by moving the two left-most sliders, which change the “a” and “b” parameters; the right-most slider zooms in and out. Better yet, canoodle directly with Süss’s equation and engage in the dialectical interplay between algebra and geometry. (Change that final z³ to a z² to see the heart in its underwear.)
|
||||
|
||||
```
|
||||
(x^2+((1+b)*y)^2+z^2-1)^3-x^2*z^3-a*y^2*z^3
|
||||
```
|
||||
@@ -0,0 +1,72 @@
|
||||
"","elevation","elev_units","longitude","latitude"
|
||||
"1",126.85,"meters",-74.2986363,40.7541939
|
||||
"2",125.19,"meters",-74.298561,40.754122
|
||||
"3",123.52,"meters",-74.298505,40.754049
|
||||
"4",121.92,"meters",-74.298435,40.753972
|
||||
"5",119.86,"meters",-74.298402,40.753872
|
||||
"6",119.86,"meters",-74.298416,40.753818
|
||||
"7",119.86,"meters",-74.298393,40.753805
|
||||
"8",118.32,"meters",-74.298233,40.753717
|
||||
"9",118.48,"meters",-74.298113,40.753706
|
||||
"10",118.48,"meters",-74.298079,40.753714
|
||||
"11",110.65,"meters",-74.297548,40.753434
|
||||
"12",108.68,"meters",-74.297364,40.753392
|
||||
"13",108.68,"meters",-74.2973338,40.7533463
|
||||
"14",107.67,"meters",-74.2972265,40.7533169
|
||||
"15",107.54,"meters",-74.297087,40.753356
|
||||
"16",107.54,"meters",-74.2970438,40.7533584
|
||||
"17",106.74,"meters",-74.296979,40.753397
|
||||
"18",107.69,"meters",-74.29689,40.753533
|
||||
"19",108.01,"meters",-74.296812,40.753661
|
||||
"20",108.34,"meters",-74.296718,40.753785
|
||||
"21",108.93,"meters",-74.296627,40.753874
|
||||
"22",109.26,"meters",-74.296514,40.753973
|
||||
"23",109.44,"meters",-74.296377,40.754026
|
||||
"24",107.8,"meters",-74.296184,40.754049
|
||||
"25",108.14,"meters",-74.29596,40.754119
|
||||
"26",108.31,"meters",-74.295761,40.754191
|
||||
"27",107.08,"meters",-74.295542,40.754277
|
||||
"28",106.54,"meters",-74.295345,40.754276
|
||||
"29",105.18,"meters",-74.295177,40.754295
|
||||
"30",104.93,"meters",-74.2951,40.754358
|
||||
"31",103.79,"meters",-74.294976,40.754381
|
||||
"32",103.79,"meters",-74.294943,40.754379
|
||||
"33",103.62,"meters",-74.294873,40.754362
|
||||
"34",103.46,"meters",-74.294805,40.754359
|
||||
"35",102.68,"meters",-74.294687,40.754349
|
||||
"36",102.78,"meters",-74.294537,40.754269
|
||||
"37",100.91,"meters",-74.294341,40.754248
|
||||
"38",101.24,"meters",-74.294228,40.754249
|
||||
"39",101.15,"meters",-74.294146,40.75427
|
||||
"40",100.73,"meters",-74.294043,40.754277
|
||||
"41",100.77,"meters",-74.293997,40.75418
|
||||
"42",97.54,"meters",-74.293672,40.75418
|
||||
"43",97.58,"meters",-74.293539,40.754324
|
||||
"44",97.41,"meters",-74.293442,40.754447
|
||||
"45",97.02,"meters",-74.29342,40.754555
|
||||
"46",96.78,"meters",-74.293397,40.754677
|
||||
"47",96.72,"meters",-74.293319,40.754787
|
||||
"48",96.98,"meters",-74.2933093,40.7549621
|
||||
"49",97.04,"meters",-74.2931914,40.7550903
|
||||
"50",95.89,"meters",-74.2931359,40.7552002
|
||||
"51",95.48,"meters",-74.293124,40.75528
|
||||
"52",95.43,"meters",-74.293142,40.755375
|
||||
"53",95.58,"meters",-74.293163,40.7554692
|
||||
"54",95.58,"meters",-74.2931806,40.7555174
|
||||
"55",95.31,"meters",-74.2930826,40.7555402
|
||||
"56",95.45,"meters",-74.2930283,40.7555572
|
||||
"57",94.19,"meters",-74.2929292,40.7555853
|
||||
"58",93.57,"meters",-74.2928114,40.7556067
|
||||
"59",92.9,"meters",-74.2927408,40.7556127
|
||||
"60",92.9,"meters",-74.2926921,40.7556257
|
||||
"61",91.46,"meters",-74.2926528,40.7556602
|
||||
"62",91.46,"meters",-74.2926104,40.7556888
|
||||
"63",88.42,"meters",-74.2925696,40.7557042
|
||||
"64",88.42,"meters",-74.2925272,40.7556876
|
||||
"65",85.62,"meters",-74.2924927,40.7556674
|
||||
"66",85.32,"meters",-74.2924503,40.755646
|
||||
"67",85.32,"meters",-74.2924377,40.7556222
|
||||
"68",85.32,"meters",-74.2924377,40.7555877
|
||||
"69",84.49,"meters",-74.2924346,40.7555365
|
||||
"70",84.49,"meters",-74.2924236,40.755502
|
||||
"71",84.36,"meters",-74.2923562,40.7554961
|
||||
|
@@ -0,0 +1 @@
|
||||
{"ys":[40.7261855236006,40.72742629854822,40.728667073495835,40.72990784844345,40.73114862339107,40.73238939833869,40.73363017328631,40.734870948233926,40.736111723181544,40.73735249812916,40.73859327307678,40.7398340480244,40.74107482297202,40.742315597919635,40.74355637286725,40.74479714781487,40.74603792276249,40.74727869771011,40.748519472657726,40.749760247605344,40.75100102255296,40.75224179750058,40.7534825724482,40.75472334739582,40.755964122343435,40.75720489729106,40.75844567223868,40.7596864471863,40.760927222133915,40.762167997081534,40.76340877202915,40.76464954697677,40.76589032192439,40.767131096872006,40.768371871819625,40.76961264676724,40.77085342171486,40.77209419666248,40.7733349716101,40.774575746557716,40.775816521505334,40.77705729645295,40.77829807140057,40.77953884634819,40.78077962129581,40.782020396243425,40.78326117119104,40.78450194613866,40.78574272108628,40.7869834960339],"zs":[56.01,51.48,51.74,44.9,45.6,48.76,51.94,61.55,73.28,66.29,63.29,61.46,58.49,50.06,44.18,41.35,39.9,39.84,36.59,39.0,32.85,30.03,33.51,41.28,48.27,62.42,60.31,47.04,45.5,48.2,53.46,64.52,90.94,99.45,88.22,77.94,74.07,67.39,57.02,48.88,45.05,48.09,43.18,39.9,39.08,40.62,33.1,31.9,36.77,43.92,71.71,69.82,57.64,46.98,60.73,60.83,96.1,142.76,137.34,115.32,94.89,84.02,76.91,67.68,56.16,48.75,51.23,49.58,44.37,39.98,41.33,39.08,33.27,34.35,38.63,74.36,76.11,64.27,50.65,61.01,87.64,127.37,144.27,154.88,154.21,121.78,101.25,89.54,78.44,65.93,57.72,53.51,54.97,50.69,45.22,40.48,37.04,35.56,33.26,36.96,77.43,64.79,71.06,63.36,57.43,106.1,134.93,142.34,148.85,155.99,159.95,124.49,103.86,87.97,76.57,68.22,60.35,57.23,55.58,51.15,42.79,40.6,41.94,34.53,34.96,78.13,73.79,75.67,56.64,60.87,96.08,128.31,138.22,143.42,153.35,161.87,155.41,122.68,104.06,87.5,77.81,68.75,64.85,60.88,59.44,47.98,44.57,45.44,42.71,35.23,77.37,77.0,77.61,59.73,63.84,99.1,113.48,135.22,152.77,151.16,158.9,162.84,153.3,120.58,103.98,87.91,79.23,73.92,67.96,64.94,53.54,44.0,50.07,46.93,43.32,88.65,84.02,80.83,65.49,59.07,77.84,103.68,125.53,147.66,160.47,159.49,164.66,165.91,146.24,118.18,102.01,88.47,80.25,74.83,70.48,62.1,49.47,48.1,53.33,48.34,99.44,88.01,84.27,82.97,60.09,69.83,92.51,113.41,135.15,149.8,164.15,160.75,163.8,167.33,147.47,118.41,101.95,88.65,82.18,78.29,69.59,55.74,49.71,51.8,57.88,102.64,104.12,97.82,74.39,68.53,60.14,77.6,99.22,117.22,130.03,153.71,162.09,161.09,164.47,167.19,139.18,114.62,97.97,87.68,83.73,76.03,60.99,51.93,49.41,59.15,114.76,115.62,99.65,95.47,95.31,70.6,60.14,75.41,100.54,122.61,141.39,157.32,160.93,163.17,167.0,158.25,129.02,112.59,96.6,89.03,80.11,65.83,56.0,49.52,54.51,121.11,111.04,114.21,111.8,105.23,102.43,66.8,74.98,99.48,111.59,126.23,144.81,163.02,164.44,165.56,165.01,157.87,129.18,108.67,96.9,87.28,74.81,60.53,53.12,52.44,123.96,126.43,127.51,124.19,107.58,92.65,67.27,74.09,95.48,102.63,123.05,143.73,153.72,166.16,164.96,166.27,166.6,156.49,122.54,104.98,94.24,81.41,70.53,60.0,55.06,132.49,128.75,142.22,132.8,116.22,95.17,78.05,65.54,73.44,94.77,122.63,150.45,159.95,162.54,164.74,165.55,167.95,167.5,141.39,116.28,102.84,88.36,78.59,68.04,59.33,135.9,129.63,135.65,149.65,131.83,109.12,92.13,67.31,71.28,95.2,105.78,133.74,155.48,169.13,167.16,163.63,164.41,168.11,159.05,128.09,109.31,95.72,85.54,79.65,67.48,139.88,133.57,135.32,141.51,145.89,119.2,96.72,77.69,69.21,80.55,95.18,129.15,144.98,165.06,158.96,167.14,159.53,164.18,156.31,133.83,121.74,108.38,93.46,86.54,79.24,142.73,152.05,156.37,143.59,147.61,126.53,103.08,90.34,92.32,71.97,83.82,113.32,135.91,156.39,150.75,161.93,157.2,155.83,154.93,150.37,140.2,119.8,102.33,94.4,90.57,136.21,140.78,156.4,162.33,152.52,138.31,127.93,95.01,89.0,83.32,74.11,102.61,125.18,134.58,135.15,151.46,152.13,149.58,153.91,156.0,162.27,132.0,115.84,105.2,99.94,133.21,139.49,147.1,157.23,167.48,154.91,135.91,111.99,94.57,90.76,78.29,83.11,102.76,112.19,120.68,136.88,137.72,144.85,153.46,161.94,169.27,165.91,133.39,118.98,107.7,136.68,139.87,152.59,158.63,167.04,165.88,161.25,126.56,102.07,93.71,79.93,81.49,96.21,93.82,101.26,124.57,146.39,150.26,147.96,158.73,168.95,173.35,156.12,130.89,116.13,131.8,135.34,149.18,158.94,158.41,153.19,153.96,152.89,109.61,101.17,103.41,91.12,79.35,83.68,90.6,118.7,139.47,152.39,155.23,154.36,163.94,171.28,171.87,141.11,123.49,128.26,127.93,136.81,138.07,139.58,140.93,137.3,139.21,119.46,103.23,100.02,95.77,81.51,93.65,103.9,120.91,126.51,147.94,160.93,159.58,158.97,170.02,173.4,171.77,133.46,129.34,123.57,125.8,127.17,134.63,140.14,141.37,132.18,121.88,112.02,104.23,98.86,81.28,97.91,96.43,113.3,139.2,143.14,155.76,166.2,158.24,165.4,171.77,172.06,140.75,112.75,119.41,120.86,124.88,134.42,145.88,159.11,160.31,147.24,125.13,112.38,100.79,87.49,88.87,99.02,114.24,130.88,155.17,156.39,166.16,161.29,161.34,161.94,158.02,158.28,106.87,113.99,118.24,122.56,133.41,145.66,155.71,165.71,165.42,155.14,127.78,111.46,91.2,91.16,97.31,106.22,134.23,149.23,164.3,163.19,170.52,162.95,168.76,152.24,161.13,121.83,121.15,119.0,121.56,129.72,140.09,1Line truncated
|
||||
@@ -0,0 +1,294 @@
|
||||
## container of points into vectors n vectors of length N
|
||||
## N points, each of size n
|
||||
|
||||
## Lesson learned -- this is a very bad idea!
|
||||
## better to handle the T a different way
|
||||
evec(T,n) = Tuple(T[] for _ in 1:n)
|
||||
evec(T, N, n) = Tuple(Vector{T}(undef, N) for _ in 1:n)
|
||||
|
||||
|
||||
## julia> @btime xs_ys1(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 83.308 μs (1013 allocations: 172.67 KiB)
|
||||
|
||||
## julia> @btime xs_ys2(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 222.371 μs (2016 allocations: 180.72 KiB)
|
||||
|
||||
## julia> @btime xs_ys3(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 1.003 ms (1019 allocations: 165.20 KiB)
|
||||
|
||||
## julia> @btime xs_ys4(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 1.115 ms (5474 allocations: 210.95 KiB)
|
||||
|
||||
## julia> @btime xs_ys5(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 1.120 ms (5474 allocations: 210.95 KiB)
|
||||
|
||||
## julia> @btime xs_ys6(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 76.604 μs (1008 allocations: 164.63 KiB)
|
||||
|
||||
## julia> @btime xs_ys7(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 74.306 μs (1008 allocations: 164.63 KiB)
|
||||
|
||||
## julia> @btime xs_ys8(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 36.098 μs (2006 allocations: 94.25 KiB)
|
||||
|
||||
## julia> @btime xs_ys9(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 85.732 μs (3006 allocations: 203.63 KiB)
|
||||
|
||||
## ....
|
||||
|
||||
## THE WINNER, but we would use one with keywords
|
||||
## julia> @btime xs_ys13a(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 62.768 μs (1003 allocations: 117.28 KiB)
|
||||
|
||||
## julia> @btime xs_ys13akw(vs) setup=(vs=[randn(1000) for i in 1:3]);
|
||||
## 65.905 μs (1003 allocations: 117.28 KiB)
|
||||
|
||||
|
||||
## make a matrix n x N, then go down 1:n
|
||||
function xs_ys1(vs)
|
||||
A=hcat(vs...)
|
||||
Tuple([A[i,:] for i in eachindex(first(vs))])
|
||||
end
|
||||
|
||||
## broadcast push!
|
||||
function xs_ys2(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
v0 = evec(T,n)
|
||||
for v in vs
|
||||
push!.(v0, v)
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
|
||||
## broadcast push!
|
||||
function xs_ys2a(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
n = length(u)
|
||||
v0 = Tuple(eltype(u)[] for _ in eachindex(u))
|
||||
for v in vs
|
||||
push!.(v0, v)
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
## broadcast setindex!
|
||||
function xs_ys3(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
v0 = evec(T,N,n)
|
||||
for (i,v) in enumerate(vs)
|
||||
setindex!.(v0, v, i)
|
||||
end
|
||||
|
||||
v0
|
||||
end
|
||||
|
||||
## 10 times faster ~77mus avoiding passing T
|
||||
function xs_ys3a(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
n = length(u)
|
||||
v0 = Tuple(Vector{eltype(u)}(undef, N) for _ in eachindex(u))
|
||||
for (i,v) in enumerate(vs)
|
||||
setindex!.(v0, v, i)
|
||||
end
|
||||
|
||||
v0
|
||||
end
|
||||
|
||||
|
||||
function xs_ys3b(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
n = length(u)
|
||||
v0 = ntuple(_ -> Vector{eltype(u)}(undef, N), n)
|
||||
for (i,v) in enumerate(vs)
|
||||
setindex!.(v0, v, i)
|
||||
end
|
||||
|
||||
v0
|
||||
end
|
||||
|
||||
## loop N n
|
||||
function xs_ys4(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
v0 = evec(T,N,n)
|
||||
|
||||
for i in 1:N
|
||||
for j in 1:n
|
||||
v0[j][i] = vs[i][j]
|
||||
end
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
|
||||
## loop N n
|
||||
function xs_ys4a(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
v0 = evec(T,N,n)
|
||||
|
||||
for (i,v) in enumerate(vs)
|
||||
for j in 1:n
|
||||
v0[j][i] = v[j]
|
||||
end
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
## fast 67mus
|
||||
function xs_ys4b(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
n = length(u)
|
||||
v0 = Tuple(Vector{eltype(u)}(undef, N) for _ in eachindex(u))
|
||||
|
||||
for (i,v) in enumerate(vs)
|
||||
for j in 1:n
|
||||
v0[j][i] = v[j]
|
||||
end
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
## loop n N
|
||||
function xs_ys5(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
v0 = evec(T,N,n)
|
||||
|
||||
for j in 1:n
|
||||
for i in 1:N
|
||||
v0[j][i] = vs[i][j]
|
||||
end
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
function xs_ys6(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
A = Matrix{T}(undef, (N,n))
|
||||
for (i,v) in enumerate(vs)
|
||||
A[i,:] = v
|
||||
end
|
||||
Tuple(A[:,i] for i in 1:n)
|
||||
end
|
||||
|
||||
function xs_ys7(vs)
|
||||
u = first(vs); N = length(vs)
|
||||
T = eltype(u); n = length(u)
|
||||
A = Matrix{T}(undef, (n, N))
|
||||
for (i,v) in enumerate(vs)
|
||||
A[:,i] = v
|
||||
end
|
||||
Tuple(A[i, :] for i in 1:n)
|
||||
end
|
||||
|
||||
# faster but doesn't wotk with plot recipes
|
||||
# and may be slower once realized
|
||||
function xs_ys8(vs)
|
||||
N = length(vs)
|
||||
u = first(vs); T = eltype(u); n = length(u)
|
||||
Tuple((vs[j][i] for j in 1:N) for i in 1:n)
|
||||
end
|
||||
|
||||
function xs_ys9(vs)
|
||||
N = length(vs)
|
||||
u = first(vs); T = eltype(u); n = length(u)
|
||||
Tuple(collect(vs[j][i] for j in 1:N) for i in 1:n)
|
||||
end
|
||||
|
||||
function xs_ys10(vs)
|
||||
N = length(vs)
|
||||
u = first(vs); T = eltype(u); n = length(u)
|
||||
v0 = evec(T,N, n)
|
||||
for j in 1:n
|
||||
v0[j][:] .= (v[j] for v in vs)
|
||||
end
|
||||
v0
|
||||
end
|
||||
|
||||
# mauro3 https://github.com/JuliaDiffEq/ODE.jl/issues/80
|
||||
_pluck(y,i) = eltype(first(y))[el[i] for el in y]
|
||||
xs_ys11(vs) = Tuple(_pluck(vs, i) for i in eachindex(first(vs)))
|
||||
|
||||
# slower
|
||||
xs_ys11a(vs) = ntuple(i->_pluck(vs, i), length(first(vs)))
|
||||
|
||||
# one liner
|
||||
xs_ys11b(vs) = Tuple(eltype(first(vs))[el[i] for el in vs] for i in eachindex(first(vs)))
|
||||
|
||||
|
||||
function xs_ys11c(vs)
|
||||
u = first(vs)
|
||||
Tuple(eltype(u)[el[i] for el in vs] for i in eachindex(u))
|
||||
end
|
||||
xs_ys11d(vs) = (u=first(vs); Tuple(eltype(u)[el[i] for el in vs] for i in eachindex(u)))
|
||||
xs_ys11e(vs) = (u=first(vs); ntuple(i->eltype(u)[v[i] for v in vs], length(u)))
|
||||
xs_ys11f(vs) = (u=first(vs);n::Int=length(u);T::DataType=eltype(u);ntuple(i->eltype(u)[v[i] for v in vs], n))
|
||||
xs_ys11g(vs::Vector{Vector{T}}) where {T} = (u=first(vs);n::Int=length(u);ntuple(i->T[v[i] for v in vs], n))
|
||||
|
||||
|
||||
@inline _pluck(T, y, i) = T[el[i] for el in y]
|
||||
function xs_ys11b(vs)
|
||||
T = eltype(first(vs))
|
||||
Tuple(_pluck(T, vs, i) for i in eachindex(first(vs)))
|
||||
end
|
||||
|
||||
function xs_ys12(vs)
|
||||
N = length(vs)
|
||||
u = first(vs); T = eltype(u); n = length(u)
|
||||
Tuple(T[el[i] for el in vs] for i in eachindex(first(vs)))
|
||||
end
|
||||
|
||||
function xs_ys12a(vs)
|
||||
N = length(vs)
|
||||
u = first(vs); T = eltype(u); n = length(u)
|
||||
ntuple( i -> T[el[i] for el in vs], n)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function xs_ys11h(vs)
|
||||
u = first(vs)
|
||||
T = eltype(u)
|
||||
Tuple(T[el[i] for el in vs] for i in eachindex(u))
|
||||
end
|
||||
|
||||
function xs_ys11i(vs)
|
||||
u = first(vs)
|
||||
Tuple(eltype(u)[el[i] for el in vs] for i in eachindex(u))
|
||||
end
|
||||
|
||||
|
||||
function _xs_ys12(vs, u::Vector{T}) where {T}
|
||||
Tuple(T[el[i] for el in vs] for i in eachindex(u))
|
||||
end
|
||||
|
||||
xs_ys13(vs, u::Vector{T}=first(vs)) where {T} = Tuple(T[el[i] for el in vs] for i in eachindex(u))
|
||||
|
||||
xs_ys13a(vs, u::Vector{T}=first(vs), n::Val{N}=Val(length(u))) where {T,N} = ntuple(i -> T[el[i] for el in vs], n)
|
||||
|
||||
|
||||
## cleaned up
|
||||
function xs_ys13a(vs, u::Vector{T}=first(vs), n::Val{N}=Val(length(u))) where {T,N}
|
||||
plucki = i -> T[el[i] for el in vs]
|
||||
ntuple(plucki, n)
|
||||
end
|
||||
|
||||
|
||||
function xs_ys13akw(vs; u::Vector{T}=first(vs), n::Val{N}=Val(length(u))) where {T,N}
|
||||
plucki = i -> T[el[i] for el in vs]
|
||||
ntuple(plucki, n)
|
||||
end
|
||||
|
||||
function xs_ys13b(vs, u::Vector{T}=first(vs), n::Val{N}=Val(length(u))) where {T,N}
|
||||
Tuple(T[el[i] for el in vs] for i in eachindex(u))
|
||||
end
|
||||
|
||||
|
||||
xs_ys14(vs) = Tuple(eltype(vs[1])[vs[i][j] for i in 1:length(vs)] for j in 1:length(vs[1]))
|
||||
|
||||
xs_ys14a(vs) = Tuple([vs[i][j] for i in 1:length(vs)] for j in 1:length(first(vs)))
|
||||
Reference in new issue
Block a user