digitalmars.D.announce - RangeExtra 10^-20
- dsimcha (9/9) Apr 24 2009 RangeExtra version 10^-20 is officially out. It consists of a small and
- Simen Kjaeraas (4/15) Apr 25 2009 I had hoped reindex would give me access to true 'random' access ranges,...
- Daniel Keep (10/34) Apr 25 2009 If I had to take a guess, I'd say it was because "uniform" isn't defined
- dsimcha (14/32) Apr 25 2009 Very cool idea. Nothing like what I had in mind as a use case for Reind...
RangeExtra version 10^-20 is officially out. It consists of a small and hopefully growing number of ranges that didn't make it into the new Phobos that I've gotten working reasonably well and I feel eventually belong in Phobos. Docs / What's there: http://cis.jhu.edu/~dsimcha/rangeextra.html Code: http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d License: Dual licensed, Phobos license or BSD (Tango style).
Apr 24 2009
dsimcha wrote:RangeExtra version 10^-20 is officially out. It consists of a small and hopefully growing number of ranges that didn't make it into the new Phobos that I've gotten working reasonably well and I feel eventually belong in Phobos. Docs / What's there: http://cis.jhu.edu/~dsimcha/rangeextra.html Code: http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d License: Dual licensed, Phobos license or BSD (Tango style).I had hoped reindex would give me access to true 'random' access ranges, but it seems this does not work: auto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup ); :p
Apr 25 2009
Simen Kjaeraas wrote:dsimcha wrote:If I had to take a guess, I'd say it was because "uniform" isn't defined in the context of reindex. Maybe this: import std.random; void foo() { auto b = reindex!((i){ return uniform(0,5); })( [0,1,2,3,40.dup ); } I don't think there's any way to get the length. -- DanielRangeExtra version 10^-20 is officially out. It consists of a small and hopefully growing number of ranges that didn't make it into the new Phobos that I've gotten working reasonably well and I feel eventually belong in Phobos. Docs / What's there: http://cis.jhu.edu/~dsimcha/rangeextra.html Code: http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d License: Dual licensed, Phobos license or BSD (Tango style).I had hoped reindex would give me access to true 'random' access ranges, but it seems this does not work: auto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup ); :p
Apr 25 2009
== Quote from Simen Kjaeraas (simen.kjaras gmail.com)'s articledsimcha wrote:seems this does not work:RangeExtra version 10^-20 is officially out. It consists of a small and hopefully growing number of ranges that didn't make it into the new Phobos that I've gotten working reasonably well and I feel eventually belong in Phobos. Docs / What's there: http://cis.jhu.edu/~dsimcha/rangeextra.html Code: http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d License: Dual licensed, Phobos license or BSD (Tango style).I had hoped reindex would give me access to true 'random' access ranges, but itauto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup ); :pVery cool idea. Nothing like what I had in mind as a use case for Reindex, but half the fun of generic programming is seeing stuff get used for things you hadn't anticipated. I spent some time trying, and for some reason I can't for the life of me get this example to work, or even the one where the length is hard-coded. It may be some obscure compiler bug, because I'm just getting weird inscrutable error messages and I can't really figure out where they're coming from. On the other hand, I really like the idea of a with-replacement random sampling primitive. This sounds like it belongs in RandomCover. Maybe Andrei can extend RandomCover (which already samples w/o replacement) to include a replacement parameter. RandomCover w/ replacement == false would do what it does now. If replacement == true, it would be an infinite range that samples with replacement.
Apr 25 2009
== Quote from dsimcha (dsimcha yahoo.com)'s article== Quote from Simen Kjaeraas (simen.kjaras gmail.com)'s articledsimcha wrote:seems this does not work:RangeExtra version 10^-20 is officially out. It consists of a small and hopefully growing number of ranges that didn't make it into the new Phobos that I've gotten working reasonably well and I feel eventually belong in Phobos. Docs / What's there: http://cis.jhu.edu/~dsimcha/rangeextra.html Code: http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d License: Dual licensed, Phobos license or BSD (Tango style).I had hoped reindex would give me access to true 'random' access ranges, but itauto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup ); :pOn the other hand, I really like the idea of a with-replacement random sampling primitive. This sounds like it belongs in RandomCover. Maybe Andrei can extend RandomCover (which already samples w/o replacement) to include a replacement parameter. RandomCover w/ replacement == false would do what it does now. If replacement == true, it would be an infinite range that samples with replacement.Here's a first attempt: I took Andrei's RandomCover, fixed bug 2865 (This version of RandomCover passes basic statistical tests for uniformity of the distribution over the permutation space), and added a template overload to allow sampling with replacement. It's under the Phobos license to make it as easy as possible to add back to Phobos. I'll file an enhancement request. http://dsource.org/projects/scrapple/browser/trunk/rangeextra/randomcover.d
Apr 25 2009
在 Sat, 25 Apr 2009 23:40:03 +0800,dsimcha <dsimcha yahoo.com> 写道:== Quote from dsimcha (dsimcha yahoo.com)'s articleLooking forward to it! -- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/== Quote from Simen Kjaeraas (simen.kjaras gmail.com)'s articledsimcha wrote:small andRangeExtra version 10^-20 is officially out. It consists of abelong inhopefully growing number of ranges that didn't make it into the new Phobos that I've gotten working reasonably well and I feel eventuallyhttp://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.dPhobos. Docs / What's there: http://cis.jhu.edu/~dsimcha/rangeextra.html Code:ranges, but it seems this does not work:License: Dual licensed, Phobos license or BSD (Tango style).I had hoped reindex would give me access to true 'random' accessauto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup ); :pOn the other hand, I really like the idea of a with-replacement random sampling primitive. This sounds like it belongs in RandomCover. Maybe Andrei can extend RandomCover (which already samples w/o replacement) to include a replacement parameter. RandomCover w/ replacement == false would do what it does now. If replacement == true, it would be an infinite range that samples with replacement.Here's a first attempt: I took Andrei's RandomCover, fixed bug 2865 (This version of RandomCover passes basic statistical tests for uniformity of the distribution over the permutation space), and added a template overload to allow sampling with replacement. It's under the Phobos license to make it as easy as possible to add back to Phobos. I'll file an enhancement request. http://dsource.org/projects/scrapple/browser/trunk/rangeextra/randomcover.d
May 09 2009