Re: Assign to Array Column

2023-02-02 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 2 February 2023 at 13:49:18 UTC, Siarhei Siamashka wrote: On Thursday, 2 February 2023 at 10:47:19 UTC, Salih Dincer wrote: #line1 31 µs #line2 33 µs Percent %0 Yes, there is a difference between O1 and O2 that cannot be understood with a benchmark! #line1 6005 µs #line2 122 µ

Re: Assign to Array Column

2023-02-02 Thread Siarhei Siamashka via Digitalmars-d-learn
On Thursday, 2 February 2023 at 10:47:19 UTC, Salih Dincer wrote: It can be seen below that the structure (LimitedArray) implemented with union is at least 15 times and at most 20 times faster. Except that it isn't. How did you manage to get such ridiculous results? Even running your program

Re: Assign to Array Column

2023-02-02 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 2 February 2023 at 05:47:34 UTC, Paul Backus wrote: Here's a solution using standard-library functions: ```d import std.range: transversal; import std.algorithm: map, fill; import std.stdio: writefln; void main() { byte[3][3] myArr; myArr[]

Re: Assign to Array Column

2023-02-01 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote: Greetings, for an array byte[3][3] myArr, I can code myArr[0] = 5 and have: 5,5,5 0,0,0 0,0,0 Can I perform a similar assignment to the column? This, myArr[][0] = 5, doesn't work. Thanks! Here's a solution using standard-library fun

Re: Assign to Array Column

2023-02-01 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 1 February 2023 at 05:51:31 UTC, Paul wrote: Thanks Salih. Much appreciated. It's my pleasure to solve this problem... I have struck upon an idea that would not affect (i think) the speed of the processor requesting memory from the heap on a page-by-page basis but limited 😀

Re: Assign to Array Column

2023-02-01 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 1 February 2023 at 13:14:47 UTC, Siarhei Siamashka wrote: On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote: Greetings, for an array byte[3][3] myArr, I can code myArr[0] = 5 and have: 5,5,5 0,0,0 0,0,0 Can I perform a similar assignment to the column? This, myArr[][0]

Re: Assign to Array Column

2023-02-01 Thread Siarhei Siamashka via Digitalmars-d-learn
On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote: Greetings, for an array byte[3][3] myArr, I can code myArr[0] = 5 and have: 5,5,5 0,0,0 0,0,0 Can I perform a similar assignment to the column? This, myArr[][0] = 5, doesn't work. This works fine for small arrays, but for large arrays

Re: Assign to Array Column

2023-01-31 Thread Paul via Digitalmars-d-learn
On Wednesday, 1 February 2023 at 03:45:11 UTC, Salih Dincer wrote: On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote: Can I perform a similar assignment to the column? This, myArr[][0] = 5, doesn't work. Of course, this question has a short answer and a long answer. So the issue is mor

Re: Assign to Array Column

2023-01-31 Thread Salih Dincer via Digitalmars-d-learn
Sorry, I forget this: ```d enum : size_t { ROW = 3, COL = 3, SUM = ROW * COL } ``` SDB@79

Re: Assign to Array Column

2023-01-31 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 31 January 2023 at 01:04:41 UTC, Paul wrote: Can I perform a similar assignment to the column? This, myArr[][0] = 5, doesn't work. Of course, this question has a short answer and a long answer. So the issue is more about column-major. I am someone who likes to talk with codes. In

Assign to Array Column

2023-01-30 Thread Paul via Digitalmars-d-learn
Greetings, for an array byte[3][3] myArr, I can code myArr[0] = 5 and have: 5,5,5 0,0,0 0,0,0 Can I perform a similar assignment to the column? This, myArr[][0] = 5, doesn't work. Thanks!