1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 22:01:46 +03:00
Commit Graph

280 Commits

Author SHA1 Message Date
Rob Rix
3dc5bf754e Compute the lookup/set offset uniformly. 2017-03-13 18:07:52 -04:00
Rob Rix
22aa2e6aba Over-allocate the state vectors by one place. 2017-03-13 17:58:49 -04:00
Rob Rix
5b17eac69d Offset the reverse array indices by -delta. 2017-03-13 17:47:02 -04:00
Rob Rix
a1acd3ea1c Unpack edit distances only where they’re used. 2017-03-13 16:15:31 -04:00
Rob Rix
c754ef0ae3 Consolidate the selection of the opposite endpoint. 2017-03-13 15:39:01 -04:00
Rob Rix
8d820361b3 Extract a common handler for the selection of the opposite vector. 2017-03-13 15:33:08 -04:00
Rob Rix
99b07c3483 Extract a common handler for the selection of the diagonal. 2017-03-13 15:25:59 -04:00
Rob Rix
93116b7f26 Extract a common handler for the edit distance by direction. 2017-03-13 15:24:00 -04:00
Rob Rix
241c5e2c4a Bind and pass the direction. 2017-03-13 15:21:17 -04:00
Rob Rix
08cf871da9 Extract a common constructor for the diagonal interval. 2017-03-13 15:16:43 -04:00
Rob Rix
7e02b60c3b Extract a common handler for producing a result from a search. 2017-03-13 15:13:31 -04:00
Rob Rix
2d7bdeff56 Produce a better error when MiddleSnake fails to find a value. 2017-03-13 14:59:02 -04:00
Rob Rix
cd051d8508 Reformat the decomposition of SearchUpToD. 2017-03-13 14:57:27 -04:00
Rob Rix
c27b271acf Extract an operation searching along a given diagonal. 2017-03-13 14:56:59 -04:00
Rob Rix
72cb2192c9 Extract an operation searching up to a given edit distance. 2017-03-13 14:52:47 -04:00
Rob Rix
96136c3647 Reorder the smart constructors. 2017-03-13 14:48:46 -04:00
Rob Rix
05f187d288 Swap the edit distance and direction parameters. 2017-03-13 13:21:39 -04:00
Rob Rix
84360367f7 Allocate the correct size for the state vectors. 2017-03-13 12:15:01 -04:00
Rob Rix
c2a3649cff Compute accurately-sized empty state for diff steps. 2017-03-13 12:11:31 -04:00
Rob Rix
e7eb4aab0f Returns don’t need state at all. 2017-03-13 12:05:04 -04:00
Rob Rix
1972dd7753 Define a Show instance for StepF a b. 2017-03-13 12:02:20 -04:00
Rob Rix
62170ff44b Define a Show1 instance for StepF. 2017-03-13 12:01:41 -04:00
Rob Rix
853c275b51 Define a Show2 instance for StepF. 2017-03-13 12:01:10 -04:00
Rob Rix
1f56cd5b9d Simplify the Show instance for State s a. 2017-03-13 12:01:03 -04:00
Rob Rix
92bb79a7a6 Define a Show instance for MyersF a b. 2017-03-13 11:58:28 -04:00
Rob Rix
6b5c9df8e6 Define a Show1 instance for MyersF a. 2017-03-13 11:57:12 -04:00
Rob Rix
e6f89c9266 Define a Show2 instance for MyersF. 2017-03-13 11:56:29 -04:00
Rob Rix
48e5119679 Define a Show1 instance for EditGraph. 2017-03-13 11:53:06 -04:00
Rob Rix
d4b0633117 Define a helper to show a vector’s contents parametrically. 2017-03-13 11:52:59 -04:00
Rob Rix
39e1cb06c4 Derive Eq & Show instances for EditGraph & Snake. 2017-03-13 11:47:38 -04:00
Rob Rix
a24c35e5ce Define a Show instance of State s a. 2017-03-13 11:41:37 -04:00
Rob Rix
cd0466dcec Define a Show1 instance of State. 2017-03-13 11:39:40 -04:00
Rob Rix
2e843a1a16 Define a Show2 instance of State. 2017-03-13 11:38:01 -04:00
Rob Rix
a59f657b08 Derive Eq & Show instances of MyersState. 2017-03-13 11:35:37 -04:00
Rob Rix
95a800660e runMyersSteps constructs the initial state itself. 2017-03-13 11:35:11 -04:00
Rob Rix
8998884e51 Select the empty state specific to a given step. 2017-03-13 11:34:50 -04:00
Rob Rix
beefe1ac20 Extract the definition of the empty state. 2017-03-13 11:33:46 -04:00
Rob Rix
315927763f Move editGraph to the implementation details section. 2017-03-13 11:32:54 -04:00
Rob Rix
6aab59ba18 Add a function to run all the steps in a myers algorithm. 2017-03-13 11:28:23 -04:00
Rob Rix
c9354e38ff Clamp graph division to the size of the inputs. 2017-03-13 11:23:10 -04:00
Rob Rix
14f96d8bf0 Invert reverse d-paths as appropriate. 2017-03-13 11:22:43 -04:00
Rob Rix
f1ad91a346 Compute reverse d-paths in the same manner as forward ones. 2017-03-10 16:15:50 -05:00
Rob Rix
781a525f87 🔥 the custom definition of at. 2017-03-10 15:23:43 -05:00
Rob Rix
b81db68867 Don’t use the delta at all. 2017-03-10 14:18:47 -05:00
Rob Rix
438dc91672 Try to implement SES recursively. 2017-03-10 14:14:04 -05:00
Rob Rix
e74119d3de 🔥 the bogus shortcuts. 2017-03-10 14:01:51 -05:00
Rob Rix
eaf898dc4a Test for inclusion in the interval given the delta. 2017-03-10 13:58:35 -05:00
Rob Rix
d419e9aa9a Offset given the delta. 2017-03-10 13:57:41 -05:00
Rob Rix
7231c64bdd Set the backwards vector with the delta. 2017-03-10 13:53:16 -05:00
Rob Rix
c4a7f35d46 Sliding can operate at the zeroth index. 2017-03-10 13:52:56 -05:00
Rob Rix
28b5a99333 Try to implement reverse d-path endpoint finding. 2017-03-10 13:52:40 -05:00
Rob Rix
e2b4b65423 Derive Eq & Show instances for some of the types. 2017-03-10 13:51:46 -05:00
Rob Rix
8aea2f6d0f Sliding can go in either direction. 2017-03-10 13:45:36 -05:00
Rob Rix
f5ddc911d7 Bind a bunch of the relevant values & functions for all constructors. 2017-03-10 13:43:03 -05:00
Rob Rix
960cb3537c Stub out setup for reverse d-path finding. 2017-03-10 13:38:29 -05:00
Rob Rix
d176490171 Ill-advised symmetry. 2017-03-10 13:36:23 -05:00
Rob Rix
a1ceb3dca4 Don’t access out of bounds elements. 2017-03-10 13:33:47 -05:00
Rob Rix
351fef725e Early return if we’ve exhausted the inputs. 2017-03-10 13:32:15 -05:00
Rob Rix
1117208430 Bind the as/bs vectors. 2017-03-10 13:29:32 -05:00
Rob Rix
f739d4e0b2 y is independent of maxD. 2017-03-10 13:21:44 -05:00
Rob Rix
9bb0ae2f5a Bind ! locally. 2017-03-10 13:18:59 -05:00
Rob Rix
a15ae4b2e0 Bounds check x & y. 2017-03-10 13:13:47 -05:00
Rob Rix
91694c4999 Maintain call-stacks. 2017-03-10 13:12:05 -05:00
Rob Rix
a8222cf0d8 🔥 GetGraph. 2017-03-10 13:09:21 -05:00
Rob Rix
6e2f098029 Don’t pass eq around. 2017-03-10 13:07:11 -05:00
Rob Rix
f00987fe89 Add smart constructors for the reader parameters. 2017-03-10 13:04:08 -05:00
Rob Rix
cd61576be9 Add constructors to retrieve the edit graph & equality function. 2017-03-10 13:03:09 -05:00
Rob Rix
b373e4c63e Add the element type parameter to Myers. 2017-03-10 13:02:12 -05:00
Rob Rix
737ab8924d Add a convenience to run LCS in its entirety. 2017-03-10 12:52:09 -05:00
Rob Rix
607e6cd63e Return the correct subsequences at the ends. 2017-03-10 12:04:09 -05:00
Rob Rix
34b2f0271b Get the middle elements in LCS. 2017-03-10 12:02:45 -05:00
Rob Rix
6a6759949e Stub in the recursive construction of the LCS. 2017-03-10 12:01:08 -05:00
Rob Rix
0e2f57821e Add a function dividing a graph in two. 2017-03-10 11:55:46 -05:00
Rob Rix
ec33d16355 Pass the relation around separately from the graph. 2017-03-10 11:51:03 -05:00
Rob Rix
d64ecd672d Add a smart constructor for LCS. 2017-03-10 11:45:32 -05:00
Rob Rix
3885f2df11 Stub in an LCS command. 2017-03-10 11:44:35 -05:00
Rob Rix
fb7bdef523 Pass edit graphs around. 2017-03-10 11:08:16 -05:00
Rob Rix
48f27267b4 Add a type representing an edit graph. 2017-03-10 11:03:21 -05:00
Rob Rix
bf7ea52248 Add the input vectors to findDPath. 2017-03-10 11:02:08 -05:00
Rob Rix
a7e4ed8015 Extract ceilDiv. 2017-03-10 10:56:32 -05:00
Rob Rix
bcb2f374e3 Fix bogosity. 2017-03-10 10:50:54 -05:00
Rob Rix
486b284c50 Add helpers for setting the forward/backward vectors. 2017-03-10 10:50:13 -05:00
Rob Rix
02ad162cca Note bogosity. 2017-03-10 10:50:01 -05:00
Rob Rix
96d3a4dcaa Separate forward/reverse d-path finding. 2017-03-10 10:37:30 -05:00
Rob Rix
dd594dbea9 🔥 offset state. 2017-03-10 10:35:33 -05:00
Rob Rix
d582bcb435 🔥 getK. 2017-03-10 10:35:23 -05:00
Rob Rix
7f932559cf Extract for & continue to the top level. 2017-03-10 10:25:25 -05:00
Rob Rix
8ca75fb092 SES operates on Vectors. 2017-03-10 10:21:38 -05:00
Rob Rix
5a6bd8c547 Define a smart constructor for the middle snake algorithm. 2017-03-09 15:44:51 -05:00
Rob Rix
9a6cac6241 Special-case handling of SES for empty lists on either side. 2017-03-09 15:42:18 -05:00
Rob Rix
d762cb7866 Take the alternation of the for loops. 2017-03-09 15:38:13 -05:00
Rob Rix
c1ababe068 Parenthesize the lambdas. 2017-03-09 15:36:04 -05:00
Rob Rix
532b402d34 Step-by-step computation of Myers’ algorithm. 2017-03-09 15:34:14 -05:00
Rob Rix
5a7cd8d6ab 🔥 For, compute fors as folds. 2017-03-09 15:34:02 -05:00
Rob Rix
b81959ac72 Define our own State type. 2017-03-09 14:21:59 -05:00
Rob Rix
69a1199268 Middle snake uses for. 2017-03-09 14:18:17 -05:00
Rob Rix
cb3e69c845 Myers performs For steps. 2017-03-09 14:17:56 -05:00
Rob Rix
31df8f05ad Define a For effect. 2017-03-09 14:17:33 -05:00
Rob Rix
34abcdcf0c Extract maxD. 2017-03-09 14:02:16 -05:00
Rob Rix
ad217cda68 Take an Int instead of a Diagonal. 2017-03-09 14:01:52 -05:00
Rob Rix
9ab575b264 at does not return in Myers. 2017-03-09 13:53:49 -05:00
Rob Rix
ca9539c9cb 🔥 isOdd in favour of odd.
🎩 @tclem.
2017-03-09 13:48:16 -05:00
Rob Rix
6917ca8f9e Add a helper to test whether a value is within an interval. 2017-03-09 12:34:50 -05:00
Rob Rix
abb71497da Add a helper to test whether an integer is odd. 2017-03-09 12:32:37 -05:00
Rob Rix
99069c3646 Stub in the computation of the furthest reverse d-path along k. 2017-03-09 12:28:05 -05:00
Rob Rix
8907ebbf8a Stub in the computation of the furthest d-path along k. 2017-03-09 12:26:44 -05:00
Rob Rix
faa7096368 Give a type for for. 2017-03-09 12:24:11 -05:00
Rob Rix
defd4a14ed Stub in the inner loop of middle snake. 2017-03-09 12:21:16 -05:00
Rob Rix
e57fb3cf84 Stub in the outer loop of middle snake. 2017-03-09 12:20:19 -05:00
Rob Rix
0e76f5a5cb Add a section header for evaluation. 2017-03-09 12:20:06 -05:00
Rob Rix
0e7667bac5 Add a smart constructor for FindDPath. 2017-03-09 12:19:58 -05:00
Rob Rix
6b696876ce Endpoint fields are strict. 2017-03-09 10:49:32 -05:00
Rob Rix
0624d24aa7 Define a test of endpoint overlap. 2017-03-09 10:48:11 -05:00
Rob Rix
4ad49d4f82 Get the endpoint at diagonal _k_. 2017-03-09 10:39:49 -05:00
Rob Rix
1a45bfcdd8 Compute the endpoint at some diagonal.
It currently doesn’t report the correct vertical index.
2017-03-09 10:39:28 -05:00
Rob Rix
2c2ab0337c Define a MonadState instance for Myers. 2017-03-09 10:38:57 -05:00
Rob Rix
a400c8f2af Model the state in Myers’ algorithm. 2017-03-09 10:30:42 -05:00
Rob Rix
384e016262 D-paths can be found in either direction. 2017-03-09 10:25:46 -05:00
Rob Rix
a2ef23491c Add a Direction type. 2017-03-09 10:25:08 -05:00
Rob Rix
aa01343a95 D-paths are reported as endpoints. 2017-03-09 10:24:37 -05:00
Rob Rix
911e03f761 Snakes are composed of endpoints. 2017-03-09 10:24:06 -05:00
Rob Rix
7889f1481b Stub in a type of endpoints. 2017-03-09 10:23:33 -05:00
Rob Rix
f6ada9b441 Stub in the decomposition of steps in Myers’ algorithm. 2017-03-09 10:22:36 -05:00
Rob Rix
aed09c20db Add a type synonym for Myers’ algorithm. 2017-03-09 10:20:10 -05:00
Rob Rix
2eb5c5183d Stub in a constructor for the top-level SES operation. 2017-03-09 10:18:50 -05:00
Rob Rix
acf68d4a43 Stub in a constructor for the furthest-reaching D-path in a given diagonal. 2017-03-09 10:17:43 -05:00
Rob Rix
1aebf61954 Report the edit distance alongside the middle snake. 2017-03-09 10:13:47 -05:00
Rob Rix
ac8b2865cf Define a MyersF datatype with a single constructor. 2017-03-09 10:12:41 -05:00
Rob Rix
9e8f6f75b3 Define a Snake datatype. 2017-03-09 10:12:30 -05:00
Rob Rix
93b9e285c2 SES.Myers
Stub in a module for Myers’ algorithm.
2017-03-09 10:10:13 -05:00