Re: Linear array to matrix

2020-04-04 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 4 April 2020 at 14:00:01 UTC, 9il wrote: On Saturday, 4 April 2020 at 09:25:14 UTC, Giovanni Di Maria wrote: [...] You may want to look into a mir-algorithm package that supports rectangular multidimensional arrays like NumPy. [...] Very good. Thank you G

Re: Linear array to matrix

2020-04-04 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 4 April 2020 at 10:52:30 UTC, MoonlightSentinel wrote: On Saturday, 4 April 2020 at 09:25:14 UTC, Giovanni Di Maria wrote: Is there a Built-in function (no code, only a built-in function) that transform a linear array to a Matrix? You can combine slide [1] and array [2]: import

Re: Linear array to matrix

2020-04-04 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 4 April 2020 at 10:52:00 UTC, Boris Carvajal wrote: On Saturday, 4 April 2020 at 09:25:14 UTC, Giovanni Di Maria wrote: Hi. Is there a Built-in function (no code, only a built-in function) that transform a linear array to a Matrix? For example: From

Re: Simple array problem

2020-04-04 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 4 April 2020 at 10:57:36 UTC, MoonlightSentinel wrote: On Saturday, 4 April 2020 at 09:09:44 UTC, Giovanni Di Maria wrote: Why the followin code gives me the error? Error: only one index allowed to index `int[3][3]` Use matrix[2][2] instead of matrix[2,2]. OK. Thank you

Linear array to matrix

2020-04-04 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi. Is there a Built-in function (no code, only a built-in function) that transform a linear array to a Matrix? For example: From [10,20,30,40,50,60,70,80,90,100,110,120]; To [ [10,20,30], [40,50,60], [70,80,90], [100,110,120] ]; Thank You very much Cheers. Giovanni

Simple array problem

2020-04-04 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi. I am very new to D Language and I apologize for my bad question. Why the followin code gives me the error? Error: only one index allowed to index `int[3][3]` import std.stdio; import std.array; void main() { int[3][3] matrix; matrix[2,2]=99; } Thank you very much GIovanni

Re: Slow UDF call?

2019-08-17 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 17 August 2019 at 20:57:44 UTC, Giovanni Di Maria wrote: On Saturday, 17 August 2019 at 20:15:02 UTC, Stefan Koch wrote: On Saturday, 17 August 2019 at 19:43:22 UTC, Giovanni Di Maria wrote: [...] Yes they do A function call has a cost. In case of a function which performes a 1

Re: Slow UDF call?

2019-08-17 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 17 August 2019 at 20:15:02 UTC, Stefan Koch wrote: On Saturday, 17 August 2019 at 19:43:22 UTC, Giovanni Di Maria wrote: [...] Yes they do A function call has a cost. In case of a function which performes a 1 cycle (nominally without ILP) operation, the overhead of the

Slow UDF call?

2019-08-17 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi, i have seen that a simple operation (in a loop) is faster than the equivalent UDF. The first example takes 4 seconds, the second example takes 16 seconds. Local variables influence the speed of execution? Thank you very much. Giovanni == import

Re: Arrays in the disk

2019-08-16 Thread Giovanni Di Maria via Digitalmars-d-learn
On Friday, 16 August 2019 at 07:27:36 UTC, zabruk wrote: may be std.mmfile can be usefull https://dlang.org/phobos/std_mmfile.html Thank you Zabruk. I will study it. Giovanni

Arrays in the disk

2019-08-16 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi Do they exist arrays in the disk? I must manage very very large data. Thank you very much. Giovanni

Re: Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
Thank you very much to Everybody! Giovanni

Re: Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:44:44 UTC, lithium iodate wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] First off you could try to use a faster RNG engine than the default. The easiest way is to define a variable containing it and passing it to the

Re: Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:17:23 UTC, Cym13 wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] To what extent isn't the quality of randomness important to you? Your posts reminds me of the way Doom (the original) did it for things like enemy behaviour

Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi to everybody I am doing some experiments about random numbers. I need "extreme speed" for the generation for numbers from 1 to 8. Generating 500_000_000 numbers with this code: - import std.stdio, std.array, std.random; void main() { byte c;

Re: Milliseconds

2019-07-12 Thread Giovanni Di Maria via Digitalmars-d-learn
On Friday, 12 July 2019 at 07:21:58 UTC, Jonathan M Davis wrote: On Friday, July 12, 2019 12:51:28 AM MDT Giovanni Di Maria via Digitalmars- d-learn wrote: [...] You mean if the time is currently 15:46:52.7205007, you want an integer value that's 720? [...] Perfect Jonathan . Thank

Milliseconds

2019-07-12 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi I have read much, before to write here. How can i store, to an int variable, the milliseconds of the current time? It's simple, but i don't find the solution. Thank you very much. Giovanni Di Maria

Re: Read a text file in any position.

2019-01-18 Thread Giovanni Di Maria via Digitalmars-d-learn
On Friday, 18 January 2019 at 08:49:08 UTC, bauss wrote: On Friday, 18 January 2019 at 08:10:25 UTC, Giovanni Di Maria wrote: Hi All I have a text file like this: 11 22 33 44 55 66 77 .. I execute these functions: i = archive.readln(); i = archive.readln(); i

Read a text file in any position.

2019-01-18 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi All I have a text file like this: 11 22 33 44 55 66 77 .. I execute these functions: i = archive.readln(); i = archive.readln(); i = archive.readln(); i = archive.readln(); so "i" is 44. Is there a method to move the pointer of file to beginning of

Re: How to reuse the space of RAM of an array of strings?

2018-12-22 Thread Giovanni Di Maria via Digitalmars-d-learn
On Friday, 21 December 2018 at 22:31:26 UTC, Steven Schveighoffer wrote: On 12/21/18 3:41 PM, Giovanni Di Maria wrote: [...] Note: alloca is a builtin intrinsic, so I wouldn't use that as a function name. Don't think it's affecting your program, but I wanted to point that out. [...]

Re: How to reuse the space of RAM of an array of strings?

2018-12-21 Thread Giovanni Di Maria via Digitalmars-d-learn
On Friday, 21 December 2018 at 21:28:14 UTC, H. S. Teoh wrote: [...] Thank you very much for your replay. I will meditate about your words. Thank you Giovanni

How to reuse the space of RAM of an array of strings?

2018-12-21 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi. Can you help me please? I asked also to "General Group" but i haven't solved my problem. I have tried many experiments but without success. I have a dynamic array of strings: string[] vec; After to have inserted dynamically 5_000_000 strings to array, for six times, i measure the RAM with

Re: Map of functions

2018-12-16 Thread Giovanni Di Maria via Digitalmars-d-learn
Thank you very much. Great!!! Giovanni

Re: Map of functions

2018-12-14 Thread Giovanni Di Maria via Digitalmars-d-learn
Thank you very much, Fantastic!!! Giovanni

Re: Map of functions

2018-12-14 Thread Giovanni Di Maria via Digitalmars-d-learn
Do you really have a nested function print() inside a nested function calculate() inside main()? That is, Hi this is only an example of names of funcions but the structure is this: void main() { // maybe some calls to calculate() } void calculate() { // maybe some calls to

Map of functions

2018-12-14 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi Is there an utility to print the functions in a source file, for example: - main() --- calculate() - print() --- simulate() - print() . Thank you very much Giovanni Di Maria

Re: Print RAM used by arrays

2018-12-14 Thread Giovanni Di Maria via Digitalmars-d-learn
Thank you very much for your precious informations. Now i will try. Thank you!!! Giovanni

Print RAM used by arrays

2018-12-13 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi. How can I know the amount of RAM allocated by a vector? For example: string[8][1000] array; for(int i=0;i<1000;i++) { array[i]=["","","","","","","",""]; } how can I know the amount of bytes of above matrix? Can I clean the memory ofter his use, without