Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 15, 2010 [Issue 4874] New: std.numeric.dotProduct doesn't work with bigints | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4874 Summary: std.numeric.dotProduct doesn't work with bigints Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc Depends on: 4872 --- Comment #0 from bearophile_hugs@eml.cc 2010-09-15 14:17:17 PDT --- With dmd 2.049beta this code compiles (but first see bug 4872 too): // program #1 import std.bigint; T dotProduct2(T)(/*in*/ T[] a1, /*in*/ T[] a2) { assert(a1.length == a2.length); T total = 0; foreach (i; 0 .. a1.length) total += a1[i] * a2[i]; return total; } void main() { BigInt[] a1 = [BigInt(1), BigInt(3), BigInt(-5)]; BigInt[] a2 = [BigInt(4), BigInt(-2), BigInt(-1)]; BigInt r = dotProduct2(a1, a2); } But the std.numeric.dotProduct() can't be used with bigints: // program #2 import std.numeric, std.bigint; void main() { BigInt[] a1 = [BigInt(1), BigInt(3), BigInt(-5)]; BigInt[] a2 = [BigInt(4), BigInt(-2), BigInt(-1)]; assert(dotProduct(a1, a2) == BigInt(3)); } If in program #1 arguments are "in" it doesn't compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 15, 2010 [Issue 4874] std.numeric.dotProduct doesn't work with bigints | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4874 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei@metalanguage.com AssignedTo|nobody@puremagic.com |andrei@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 15, 2010 [Issue 4874] std.numeric.dotProduct doesn't work with bigints | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4874 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-09-15 15:11:49 PDT --- That's the same issue as 4301. BigInt isn't yet const-correct. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 11, 2013 [Issue 4874] std.numeric.dotProduct doesn't work with bigints | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4874 --- Comment #2 from Andrei Alexandrescu <andrei@erdani.com> 2013-03-10 19:20:19 PDT --- Assigning to Don. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation