James Carr
4beda7da9c
Changed the implementation of distance() so that it uses the memory inefficient version to prevent breakage in the API. Efficient version has been moved to distanceLowMem() in the struct and is called internally by levenshteinDistance()
2014-07-13 14:01:56 +01:00
James Carr
5102e9e273
Removed calls to matrix() in distance()
...
Since _matrix is now a single dimension matrix, calls to matrix() have
been removed and replaced with direct access equivalents.
2014-07-13 13:26:38 +01:00
James Carr
3e037f463e
Refactored distance() and corrected path()
...
Refactored distacen() so that it now accepts the lengths of the ranges
because we already calculate these in levenshteinDistance().
Altered ss in distance() and tt in distanceWithPath().
Moved popFront()’s to after their final usage to handle transitive
ranges.
Corrected path() so that it calls distanceWithPath() instead of
distance().
2014-07-13 13:26:38 +01:00
James Carr
0d0a2c0308
Refactored, added unit tests and removed opIndex.
...
Moved checks for which Range is longer to levenshteinDistance() method.
Reverted to implementation found in original distance() with regards to
using front/popFront instead of opIndex.
Fixed formatting of return statement.
Added two unit tests for levenshteinDistance().
Credit to @Poita.
2014-07-13 13:26:38 +01:00
James Carr
a9ae1023a2
Moved previous distance() implementation
...
Moved to be a private method and only expose new more memory efficient
distance(). This is done because we need the old implementation for
path(). Modified levenshteinDistanceAndPath() to use the old distance()
to reflect this.
2014-07-13 13:26:37 +01:00
James Carr
7f5aff5693
Fixed formatting
...
Moved all braces so that they are on their own lines and removed the trailing whitespace after function declaration;
2014-07-13 13:26:37 +01:00
James Carr
3a87433439
Modified Levenshtein distance()
...
Modified the implementation of Levenshtein distance so that it now uses O(n) memory but retains the same time complexity. However, does not work with path().
2014-07-13 13:26:37 +01:00
James Carr
4c9c85c183
Modified Levenshtein distance()
...
Modified the implementation of Levenshtein distance so that it now uses O(n) memory but retains the same time complexity. However, does not work with path().
2014-07-13 13:26:37 +01:00
Lionello Lunesu
2815d548d3
Added std.algorithm.safeLess for safe signed/unsigned comparison; rewrote min/max
2014-07-13 13:09:45 +08:00
H. S. Teoh
6e51fdf469
Fix range violation for cartesianProduct of empty ranges.
...
Completes the fix for: https://issues.dlang.org/show_bug.cgi?id=10693
2014-07-12 07:07:52 -07:00
Walter Bright
bcceb5424b
Merge pull request #2276 from quickfur/cprod_improve1
...
cartesianProduct improvement
2014-07-10 14:11:41 -07:00
safety0ff
b54f32eee6
std.algorithm.remove: Change pop____N to pop____Exactly
2014-07-02 19:57:44 -04:00
safety0ff
93068b15bd
std.algorithm.remove: Fix constraints and change popBack loop to popBackN
2014-07-02 19:57:44 -04:00
H. S. Teoh
95ea9c82ea
Get rid of exponential template bloat for most common use case of cartesianProduct.
2014-07-02 16:01:35 -07:00
H. S. Teoh
66287d0f29
Update unittest and example code to reflect new ordering.
2014-07-02 15:59:32 -07:00
H. S. Teoh
a8f80e04f2
cartesianProduct: default order should be lexicographically sorted.
2014-07-02 15:59:32 -07:00
David Nadlinger
733b895a8a
[trivial] Fix copy/paste error in minPos doc comment.
2014-06-28 09:09:00 +02:00
safety0ff
6ff3378c79
Add unittests bug #12889
2014-06-16 19:42:30 -04:00
Dmitry Olshansky
fdf5307d88
Merge pull request #2202 from monarchdodra/swapPointsTo
...
reinsert doesPointTo in swap/move
2014-05-31 06:55:46 -07:00
monarchdodra
b974846d2d
Re-insert doesPointTo in swap/move
2014-05-31 13:44:12 +02:00
Dmitry Olshansky
66fcbadf4d
Merge pull request #2053 from monarchdodra/maxTweak
...
Tweak min and max for yet more efficiency
2014-05-31 04:10:15 -07:00
Dmitry Olshansky
0ae323dc6f
Merge pull request #2167 from monarchdodra/pointsTo
...
Fix issues 9975 & 12479
2014-05-23 22:44:25 +04:00
Walter Bright
c6b3eb0a85
convert jagged array with rectangular one
2014-05-18 00:39:19 -07:00
monarch dodra
a4e448be50
Tweak min and max for yet more efficiency
...
I checked the generated assembly code, and it looks pretty damn good. I've not been able to achieve any better anyways.
2014-05-17 20:06:12 +02:00
monarchdodra
c885157507
Change pointsTo to mayPointTo and doesPointTo
2014-05-14 21:58:02 +02:00
monarch dodra
254290daf7
Merge pull request #2128 from AndrejMitrovic/Fix11253
...
Issue 11253 - std.algorithm.count is not nothrow
2014-05-09 22:08:25 +02:00
monarchdodra
d609bd332f
Sed "@safe pure nothrow"
2014-05-06 08:21:13 +02:00
Andrej Mitrovic
5ad48eb130
Fix Issue 11253 - std.algorithm.count is not nothrow.
2014-04-28 14:40:15 +02:00
Andrej Mitrovic
8c24b1e875
Fix Issue 12293 - Add forward to std.algorithm's cheat-sheet.
2014-04-27 01:00:06 +02:00
Andrej Mitrovic
e549dd037b
Strip spaces.
2014-04-26 21:13:39 +02:00
Andrej Mitrovic
6f05fc3f63
Merge pull request #2075 from monarchdodra/sumInfer
...
safe pure nothrow sort and sum
2014-04-26 01:08:47 +02:00
monarch dodra
79903eb199
Merge pull request #2107 from AndrejMitrovic/Fix7246
...
Issue 7246 - Provide a simpler example for std.algorithm.remove.
2014-04-23 19:56:37 +02:00
Andrej Mitrovic
899155194a
Fix Issue 7246 - Provide a simpler example for std.algorithm.remove.
2014-04-23 16:39:17 +02:00
Andrej Mitrovic
ecddbf64dc
Fix Issue 11462 - std.algorithm.multiSort was missing from the index.
2014-04-22 23:45:29 +02:00
Andrej Mitrovic
d4b0e70c67
Fix Issue 11978 - Fix typos in std.algorithm documentation referencing parameter names.
2014-04-22 22:11:32 +02:00
monarchdodra
6c98c325f9
safe pure nothrow sort and sum
2014-04-09 18:48:24 +02:00
monarchdodra
6123ca3371
Fix Issue 12434 - std.algorithm.sum of immutable array too
...
https://d.puremagic.com/issues/show_bug.cgi?id=12434
Simply uses the inference's `Unqual` type as a seed, rather than the straight up result.
Also add some unittesting while at it.
2014-04-07 07:48:53 +02:00
Dmitry Olshansky
98434a5181
Merge pull request #2052 from monarchdodra/copyAssert
...
Add asserts in Copy (and remove an enforce)
2014-03-30 23:50:27 +04:00
Dmitry Olshansky
66fd049ea9
Make move CTFEable for simple structs and classes
...
memcpy is not CTFEable, so avoid it for structs without
dtor, postblit that can be assigned with plain =.
This leaves as is (compile error in CTFE) structs that contain
immutable/const memebers the fact that moves overwrites such
fields is questionable to begin with.
2014-03-28 00:24:21 +04:00
monarch dodra
dacbef4c98
Add asserts in Copy (and remove an enforce)
...
Adding extra asserts always helps. As for the enforce, I'm unsure why it was there in the first place: All the other branches simply make the assumption the target is large enough.
2014-03-27 18:49:12 +01:00
Andrei Alexandrescu
cecd745cef
Merge pull request #2015 from monarchdodra/emplaceQual
...
Improve emplaceRef for qualified construction
2014-03-26 18:03:39 -07:00
monarch dodra
4e4f73b646
Remove pointsTo in move
...
as well as remove erroneous documentation.
2014-03-25 21:21:33 +01:00
monarch dodra
782441ee1d
Fixup for 9975: swap and pointsTo
...
Fixing 9975 revealed that checking `pointsTo` was creating problems in swap for legitimate use cases.
This is because:
1. pointsTo can sometimes create "false positives"
2. Internal pointing is not outright forbidden, it is just that the runtime is allowed to make the assumption they don't exist.
While swapping aliasing objects is a sign of stink, it should still "just work".
2014-03-25 21:21:33 +01:00
monarch dodra
aec513e542
Revert
2014-03-24 16:39:56 +00:00
monarch dodra
72d78547cf
Update algorithm.d
2014-03-24 16:16:19 +00:00
monarch dodra
7f76f3fc3a
Update algorithm.d
2014-03-24 16:13:29 +00:00
monarch dodra
8370276924
Fix Issue 12449
...
Undefined format in std.algorithm.max
2014-03-24 13:41:44 +00:00
Andrei Alexandrescu
9404dd477f
Merge pull request #1970 from monarchdodra/sumseed
...
Give sum a seed capability
2014-03-19 18:08:06 -07:00
monarchdodra
59ad77ad9f
Improve emplaceRef for qualified construction
2014-03-17 22:48:30 +01:00
monarchdodra
69d181290c
Remove incorrect save
2014-03-14 22:41:34 +01:00