Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
4
Task/Closest-pair-problem/J/closest-pair-problem-1.j
Normal file
4
Task/Closest-pair-problem/J/closest-pair-problem-1.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
vecl =: +/"1&.:*: NB. length of each vector
|
||||
dist =: <@:vecl@:({: -"1 }:)\ NB. calculate all distances among vectors
|
||||
minpair=: ({~ > {.@($ #: I.@,)@:= <./@;)dist NB. find one pair of the closest points
|
||||
closestpairbf =: (; vecl@:-/)@minpair NB. the pair and their distance
|
||||
17
Task/Closest-pair-problem/J/closest-pair-problem-2.j
Normal file
17
Task/Closest-pair-problem/J/closest-pair-problem-2.j
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
]pts=:10 2 ?@$ 0
|
||||
0.654682 0.925557
|
||||
0.409382 0.619391
|
||||
0.891663 0.888594
|
||||
0.716629 0.9962
|
||||
0.477721 0.946355
|
||||
0.925092 0.81822
|
||||
0.624291 0.142924
|
||||
0.211332 0.221507
|
||||
0.293786 0.691701
|
||||
0.839186 0.72826
|
||||
|
||||
closestpairbf pts
|
||||
+-----------------+---------+
|
||||
|0.891663 0.888594|0.0779104|
|
||||
|0.925092 0.81822| |
|
||||
+-----------------+---------+
|
||||
17
Task/Closest-pair-problem/J/closest-pair-problem-3.j
Normal file
17
Task/Closest-pair-problem/J/closest-pair-problem-3.j
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
]pts=:10 4 ?@$ 0
|
||||
0.559164 0.482993 0.876 0.429769
|
||||
0.217911 0.729463 0.97227 0.132175
|
||||
0.479206 0.169165 0.495302 0.362738
|
||||
0.316673 0.797519 0.745821 0.0598321
|
||||
0.662585 0.726389 0.658895 0.653457
|
||||
0.965094 0.664519 0.084712 0.20671
|
||||
0.840877 0.591713 0.630206 0.99119
|
||||
0.221416 0.114238 0.0991282 0.174741
|
||||
0.946262 0.505672 0.776017 0.307362
|
||||
0.262482 0.540054 0.707342 0.465234
|
||||
|
||||
closestpairbf pts
|
||||
+------------------------------------+--------+
|
||||
|0.217911 0.729463 0.97227 0.132175|0.708555|
|
||||
|0.316673 0.797519 0.745821 0.0598321| |
|
||||
+------------------------------------+--------+
|
||||
Loading…
Add table
Add a link
Reference in a new issue