Re: library to solve the system of linear equations

2022-10-18 Thread Siarhei Siamashka via Digitalmars-d-learn
On Monday, 17 October 2022 at 20:05:24 UTC, mw wrote: On Monday, 17 October 2022 at 19:54:12 UTC, Yura wrote: it is possible to install the most recent ldc and gdc compilers on Ubuntu 18.04? Yes, I used LDC on the same system. What's the recommended way to have up to date D compilers in Ub

Re: library to solve the system of linear equations

2022-10-18 Thread Siarhei Siamashka via Digitalmars-d-learn
On Monday, 17 October 2022 at 20:22:47 UTC, jmh530 wrote: If you have a problem with support for mir, submit a bug report. I don't think gdc is supported, but ldc should be. GDC12 has finally upgraded its D language frontend version to 2.100 and I have successfully compiled a simple lubeck exa

parallel is slower than serial

2022-10-18 Thread Yura via Digitalmars-d-learn
Dear All, I am trying to make a simple code run in parallel. The parallel version works, and gives the same number as serial albeit slower. First, the parallel features I am using: import core.thread: Thread; import std.range; import std.parallelism:parallel; import std.parallelism:taskPool;

Re: parallel is slower than serial

2022-10-18 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 11:56:30 UTC, Yura wrote: What I am doing wrong? The size of your task are way too small. To win something with OS threads, you must think of tasks that takes on the order of milliseconds rather than less than 0.1ms. Else you will just pay extra in synchronizati

Re: library to solve the system of linear equations

2022-10-18 Thread mw via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 09:56:09 UTC, Siarhei Siamashka wrote: On Monday, 17 October 2022 at 20:05:24 UTC, mw wrote: On Monday, 17 October 2022 at 19:54:12 UTC, Yura wrote: it is possible to install the most recent ldc and gdc compilers on Ubuntu 18.04? Yes, I used LDC on the same sys

Re: parallel is slower than serial

2022-10-18 Thread Siarhei Siamashka via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 11:56:30 UTC, Yura wrote: ```D // Then for each Sphere, i.e. dot[i] // I need to do some arithmetics with itself and other dots // I have only parallelized the inner loop, i is fixed. It's usually a much better idea to parallelize the outer loop. Even OpenMP tuto

Re: parallel is slower than serial

2022-10-18 Thread Ali Çehreli via Digitalmars-d-learn
On 10/18/22 06:24, Guillaume Piolat wrote: > To win something with OS threads, you must think of tasks that takes on > the order of milliseconds rather than less than 0.1ms. > Else you will just pay extra in synchronization costs. In other words, the OP can adjust work unit size. It is on the of

Re: parallel is slower than serial

2022-10-18 Thread Yura via Digitalmars-d-learn
Thank you, folks, for your hints and suggestions! Indeed, I re-wrote the code and got it substantially faster and well paralleled. Insted of making inner loop parallel, I made parallel both of them. For that I had to convert 2d index into 1d, and then back to 2d. Essentially I had to calcula

Re: library to solve the system of linear equations

2022-10-18 Thread Yura via Digitalmars-d-learn
Yes, did the same and it worked. The amazing thing is that the system solver turned out to be natively parallel and runs smoothly! On Tuesday, 18 October 2022 at 15:22:02 UTC, mw wrote: On Tuesday, 18 October 2022 at 09:56:09 UTC, Siarhei Siamashka wrote: On Monday, 17 October 2022 at 20:05:2

Find out what type my class is being converted to for comparisons

2022-10-18 Thread Matthew Rushworth via Digitalmars-d-learn
I am in the process of building a matrix class (uni project, with my choice of programming language) and appear to have run into a problem that I'm not too sure how to fix. My class uses templates to define the shape of the matrix, although I'm not sure if that matters. As part of my class, I

Re: Find out what type my class is being converted to for comparisons

2022-10-18 Thread rikki cattermole via Digitalmars-d-learn
Well its not a type system issue. Making u = n, that'll returns true. So the problem almost certainly lies with IEEE-754. They are horrible to compare (float/double). Unfortunately you are stuck calling functions like isClose to compare. https://dlang.org/phobos/std_math_operations.html#.isClo

Re: Find out what type my class is being converted to for comparisons

2022-10-18 Thread Matthew Rushworth via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 18:59:37 UTC, rikki cattermole wrote: Well its not a type system issue. Making u = n, that'll returns true. So the problem almost certainly lies with IEEE-754. They are horrible to compare (float/double). Unfortunately you are stuck calling functions like isClose

warning LNK4255 - How to solve this warning

2022-10-18 Thread Hipreme via Digitalmars-d-learn
I get the warning `warning LNK4255: library contain multiple objects of the same name; linking object as if no debug info` when dealing a project with multiple static libraries. Is there any way to know which files produced this error or at least the symbol names that are clashing? I'm totally

Re: warning LNK4255 - How to solve this warning

2022-10-18 Thread Ali Çehreli via Digitalmars-d-learn
On 10/18/22 12:26, Hipreme wrote: > Is there any way to know which files produced this error or at least the > symbol names that are clashing? I'm totally helpless about this error. There is 'nm' on Posix systems that lists symbols in object files (including libraries and programs). Ali

Re: Find out what type my class is being converted to for comparisons

2022-10-18 Thread ag0aep6g via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 18:53:41 UTC, Matthew Rushworth wrote: The entirety of opEquals: ``` /// both matrices have to have an identical shape to compare /// each element must be identical to match bool opEquals(size_t X, size_t Y)(const Matrix!(X,Y) m1, const Matrix!(X,Y) m2) { for

Re: warning LNK4255 - How to solve this warning

2022-10-18 Thread Hipreme via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 19:38:39 UTC, Ali Çehreli wrote: On 10/18/22 12:26, Hipreme wrote: > Is there any way to know which files produced this error or at least the > symbol names that are clashing? I'm totally helpless about this error. There is 'nm' on Posix systems that lists symbols

Re: Find out what type my class is being converted to for comparisons

2022-10-18 Thread Matthew Rushworth via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 20:02:02 UTC, ag0aep6g wrote: On Tuesday, 18 October 2022 at 18:53:41 UTC, Matthew Rushworth wrote: The entirety of opEquals: ``` /// both matrices have to have an identical shape to compare /// each element must be identical to match bool opEquals(size_t X, size_

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Oct 15, 2022 at 12:47:02AM +, Mike Parker via Digitalmars-d-learn wrote: > On Friday, 14 October 2022 at 22:17:52 UTC, H. S. Teoh wrote: > > > Given that this particular trap crops up regularly, perhaps some > > sort of warning ought to be added. Once the @nodiscard DIP is > > accepte

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread rikki cattermole via Digitalmars-d-learn
https://github.com/dlang/dmd/blob/master/druntime/src/core/attribute.d#L292

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 00:57:31 UTC, H. S. Teoh wrote: Has it really been implemented? I tested the latest git master, the following code doesn't compile: it only applies to types, not to functions.

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Oct 19, 2022 at 01:15:37AM +, Adam D Ruppe via Digitalmars-d-learn wrote: > On Wednesday, 19 October 2022 at 00:57:31 UTC, H. S. Teoh wrote: > > Has it really been implemented? I tested the latest git master, the > > following code doesn't compile: > > it only applies to types, not t

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread mw via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 01:30:23 UTC, H. S. Teoh wrote: On Wed, Oct 19, 2022 at 01:15:37AM +, Adam D Ruppe via it only applies to types, not to functions. Wat... so what's the use of it then? So it's not possible to mark the return value of an int function @mustUse without mak

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread rikki cattermole via Digitalmars-d-learn
On 19/10/2022 2:30 PM, H. S. Teoh wrote: On Wed, Oct 19, 2022 at 01:15:37AM +, Adam D Ruppe via Digitalmars-d-learn wrote: On Wednesday, 19 October 2022 at 00:57:31 UTC, H. S. Teoh wrote: Has it really been implemented? I tested the latest git master, the following code doesn't compile:

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 01:34:54 UTC, mw wrote: Is there any (design) doc about this? scroll up, click the link from this very thread. https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md#design-goals-and-possible-alternatives

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread mw via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 01:38:27 UTC, Adam D Ruppe wrote: On Wednesday, 19 October 2022 at 01:34:54 UTC, mw wrote: Is there any (design) doc about this? scroll up, click the link from this very thread. https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md#design-goals-an

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 01:49:26 UTC, mw wrote: On Wednesday, 19 October 2022 at 01:38:27 UTC, Adam D Ruppe wrote: On Wednesday, 19 October 2022 at 01:34:54 UTC, mw wrote: Is there any (design) doc about this? scroll up, click the link from this very thread. https://github.com/dlang

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 01:34:54 UTC, mw wrote: On Wednesday, 19 October 2022 at 01:30:23 UTC, H. S. Teoh wrote: On Wed, Oct 19, 2022 at 01:15:37AM +, Adam D Ruppe via it only applies to types, not to functions. Wat... so what's the use of it then? So it's not possible to mark

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 03:10:29 UTC, Mike Parker wrote: It's right there in the summary of the Final Review of the DIP that I linked above: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md#final-review I meant to say the summary of the formal assessment. One of

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread mw via Digitalmars-d-learn
@mustuse as a function attribute was in the original version of the DIP. It was vetoed by Walter. Thus, only the type attribute remains in the accepted version. Let's continue the discussion here: https://forum.dlang.org/thread/nmornkxaxddfziqmq...@forum.dlang.org in general, it's about: comm

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread zjh via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 04:59:40 UTC, mw wrote: ... Why can't do it `in one step`? Why always afraid to `add features`? C++ is `so complicated` ,but that people are not afraid to continue to `add features`.

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread zjh via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 05:41:26 UTC, zjh wrote: Why can't do it `in one step`? Why always afraid to `add features`? C++ is `so complicated` ,but that people are not afraid to continue to `add features`. There is also `class level private`. I saw someone start it by himself, and he

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread zjh via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 05:50:18 UTC, zjh wrote: In my opinion, as long as `users` have reasonable needs, languages should added corresponding features, instead of becoming religions. `Some features` are very popular for users,I really don't know why they didn't add it. When you

Re: Can someone tell me what the compiler thought I was trying to do?

2022-10-18 Thread zjh via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 05:41:26 UTC, zjh wrote: Why always afraid to `add features`? C++ is `so complicated` ,but that people are not afraid to continue to `add features`. Look at the `emerging` languages, which are not crazy about `adding features`. Even `go` is adding generics.