Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 11 February 2017 at 21:56:54 UTC, Era Scarecrow wrote: Just ran the unittests under the dmd profiler, says the algorithm is 11% faster now. So yeah slightly more optimized. Ran some more tests. Without optimization but with with 4 levels (a 2.5Mb table), it gains to a whopping

Re: usage of ref foreach with variadic functions fails with "cannot be ref"

2017-02-11 Thread Michael Coulombe via Digitalmars-d-learn
On Saturday, 11 February 2017 at 15:02:11 UTC, error wrote: On Saturday, 11 February 2017 at 14:43:18 UTC, rikki cattermole wrote: Try: foreach(i, v; vars) { vars[i] = ...; } Perfect! Thanks so much - I wish that hint was in the documentation for variadic functions, although I guess

Re: Gc collects trigger access violation exception

2017-02-11 Thread mashomee via Digitalmars-d-learn
problem solved now. Just not use gc_setProxy.

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 12 February 2017 at 00:43:55 UTC, Nestor wrote: I fail to see where you are declaring QG10Matrix2, because apparently it's an array of chars, but buildMatrix2 returns an array of int (2560 elements??) with lots of -1 values. I declared it here:

Re: Why can't I init a new var from const var?

2017-02-11 Thread ag0aep6g via Digitalmars-d-learn
On 02/12/2017 12:15 AM, Random D user wrote: I can init a variable from mutable source without defining any constructor or assignment operators, but not if the source is const. I would imagine the behavior to be the same with mutable and const source, since it's just reading the source and

Re: Why can't I init a new var from const var?

2017-02-11 Thread Ali Çehreli via Digitalmars-d-learn
On 02/11/2017 03:15 PM, Random D user wrote: > I can init a variable from mutable source without defining any > constructor or assignment operators, but not if the source is const. I > would imagine the behavior to be the same with mutable and const source, > since it's just reading the source

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Nestor via Digitalmars-d-learn
On Saturday, 11 February 2017 at 21:41:11 UTC, Era Scarecrow wrote: On Saturday, 11 February 2017 at 21:02:40 UTC, Era Scarecrow wrote: Yes i know, which is why i had 3 to calculate 2 inputs because the third is the temp/previous calculation. Alright I've found the bug and fixed it, and it

Why can't I init a new var from const var?

2017-02-11 Thread Random D user via Digitalmars-d-learn
I can init a variable from mutable source without defining any constructor or assignment operators, but not if the source is const. I would imagine the behavior to be the same with mutable and const source, since it's just reading the source and copying it. Is there a reason for this? Or is

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 11 February 2017 at 21:41:11 UTC, Era Scarecrow wrote: But it seriously is a lot of overhead for such a simple function. Just ran the unittests under the dmd profiler, says the algorithm is 11% faster now. So yeah slightly more optimized. Another level and we could probably

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 11 February 2017 at 21:02:40 UTC, Era Scarecrow wrote: Yes i know, which is why i had 3 to calculate 2 inputs because the third is the temp/previous calculation. Alright I've found the bug and fixed it, and it passes with flying colors (brute force tests up to 6 digits);

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 11 February 2017 at 20:19:51 UTC, Nestor wrote: Notice this is no ordinary matrix, but an Anti-Simmetric QuasiGroup of order 10, and tmpdigit (called interim in the algorithm) is used in each round (although the function isn't recursive) together with each digit to calculate final

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Nestor via Digitalmars-d-learn
On Saturday, 11 February 2017 at 11:45:02 UTC, Era Scarecrow wrote: On Friday, 10 February 2017 at 11:27:02 UTC, Nestor wrote: Thank you for the detailed reply. I wasn't able to follow you regarding the multilevel stuff though :( The idea behind it is like this (which you can scale up):

Re: usage of ref foreach with variadic functions fails with "cannot be ref"

2017-02-11 Thread error via Digitalmars-d-learn
On Saturday, 11 February 2017 at 14:43:18 UTC, rikki cattermole wrote: Try: foreach(i, v; vars) { vars[i] = ...; } Perfect! Thanks so much - I wish that hint was in the documentation for variadic functions, although I guess it suggests an inefficiency in the compiler - since there

Re: Why do static arrays affect executable size?

2017-02-11 Thread Bastiaan Veelo via Digitalmars-d-learn
Thanks for the clarifications.

Re: Why do static arrays affect executable size?

2017-02-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 11 February 2017 at 00:16:04 UTC, sarn wrote: If you explicitly initialise the array to all 0.0, you should see it disappear from the binary. I was actually wondering whether initialisation would make a difference, so thank you for this. Bastiaan.

Re: usage of ref foreach with variadic functions fails with "cannot be ref"

2017-02-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/02/2017 3:41 AM, error wrote: I'm making a serializer that has a variadic write method that takes arbitrary params and serializes them; I want to do the same thing with a read method ( pass in your params by ref, and it populates them with data ) - however, I run into a compiler error -

usage of ref foreach with variadic functions fails with "cannot be ref"

2017-02-11 Thread error via Digitalmars-d-learn
I'm making a serializer that has a variadic write method that takes arbitrary params and serializes them; I want to do the same thing with a read method ( pass in your params by ref, and it populates them with data ) - however, I run into a compiler error - "cannot be ref" in the foreach

Re: Can this implementation of Damm algorithm be optimized?

2017-02-11 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 10 February 2017 at 11:27:02 UTC, Nestor wrote: Thank you for the detailed reply. I wasn't able to follow you regarding the multilevel stuff though :( The idea behind it is like this (which you can scale up): static immutable int[] QG10Matrix2 = buildMatrix2(); int[]