Re: How to sort 2D Slice along 0 axis in mir.ndslice ?

2020-03-10 Thread 9il via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 00:24:13 UTC, jmh530 wrote: On Tuesday, 10 March 2020 at 23:31:55 UTC, p.shkadzko wrote: [snip] Below does the same thing as the numpy version. /+dub.sdl: dependency "mir-algorithm" version="~>3.7.18" +/ import mir.ndslice.sorting : sort; import mir.ndslice.topo

Re: std.bitmanip help - how to combine bitfields and read

2020-03-10 Thread kookman via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 05:25:43 UTC, kookman wrote: I am using libpcap to read from stored pcap files, and want to use std.bitmanip.bitfields to read TCP flags from the file, using a struct like: struct TcpHeader { align(1): ushort srcPort; ushort dstPort; uint seqNo;

std.bitmanip help - how to combine bitfields and read

2020-03-10 Thread kookman via Digitalmars-d-learn
I am using libpcap to read from stored pcap files, and want to use std.bitmanip.bitfields to read TCP flags from the file, using a struct like: struct TcpHeader { align(1): ushort srcPort; ushort dstPort; uint seqNo; uint ackNo; mixin(bitfields!( bool, "flagFin",

Re: How to sort 2D Slice along 0 axis in mir.ndslice ?

2020-03-10 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 23:31:55 UTC, p.shkadzko wrote: [snip] Below does the same thing as the numpy version. /+dub.sdl: dependency "mir-algorithm" version="~>3.7.18" +/ import mir.ndslice.sorting : sort; import mir.ndslice.topology : byDim; import mir.ndslice.slice : sliced; void main(

How to sort 2D Slice along 0 axis in mir.ndslice ?

2020-03-10 Thread p.shkadzko via Digitalmars-d-learn
I need to reproduce numpy sort for 2D array. -- import numpy as np a = [[1, -1, 3, 2], [0, -2, 3, 1]] b = np.sort(a) b # array([[-1, 1, 2, 3], #[-2, 0, 1, 3]]) -- Numpy sorted the array by columns, which visually look

Re: Compilation error: undefined reference to 'cblas_dgemv' / 'cblas_dger' / 'cblas_dgemm'

2020-03-10 Thread Pavel Shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 20:47:07 UTC, p.shkadzko wrote: On Sunday, 12 January 2020 at 13:07:33 UTC, dnsmt wrote: On Saturday, 11 January 2020 at 16:45:22 UTC, p.shkadzko wrote: I am trying to run example code from https://tour.dlang.org/tour/en/dub/lubeck ... This is Linux Manjaro with

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-10 Thread mark via Digitalmars-d-learn
I've managed to make a cut-down version that's < 170 LOC. It needs to be run on Debian or a Debian-based Linux (e.g., Ubuntu). Below is the full source followed by the error output. // app.d import std.typecons: Tuple; void main() { import std.stdio: writeln, writefln; auto model = Mo

Re: Aliases to mutable thread-local data not allowed

2020-03-10 Thread mark via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 15:27:04 UTC, Steven Schveighoffer wrote: On 3/10/20 7:09 AM, mark wrote: [snip] Still, the correct thing here is to handle immutable(Deb). However, I'd strongly caution you against casting away immutable, that can lead to undefined behavior in D. Better to just s

Re: Introduction and request for help

2020-03-10 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 9 March 2020 at 22:48:35 UTC, Kendell wrote: Hey Everyone, I'm a new D developer and therefore new to Gtkd. By day I'm an android developer using Kotlin and most of my hobby projects are in Go. [...] I opened an issue about a year ago when I started playing around with d. looks

Re: Introduction and request for help

2020-03-10 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2020-03-10 at 14:18 +, Ron Tarrant via Digitalmars-d-learn wrote: > On Monday, 9 March 2020 at 22:48:35 UTC, Kendell wrote: > > > Hey Everyone, > > > > I'm a new D developer and therefore new to Gtkd. > > So far I've had no problems building this project with DUB. > > However I want

Re: Aliases to mutable thread-local data not allowed

2020-03-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/10/20 7:09 AM, mark wrote: I just tried:     auto jobs = tids.length;     while (jobs) {     receive(     (Deb deb) { debForName[deb.name] = cast(Deb)deb; },     (DoneMessage m) { jobs--; }     );     }

Re: New with alias

2020-03-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/10/20 2:09 AM, tcak wrote: I write a code as below: auto result = new char[4]; It allocates memory as expected. Later I define an alias and do the above step: alias Pattern = char[4]; auto result = new Pattern; But compiler says: Error: new can only create structs, dynamic arrays or

Re: Introduction and request for help

2020-03-10 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 9 March 2020 at 22:48:35 UTC, Kendell wrote: Hey Everyone, I'm a new D developer and therefore new to Gtkd. So far I've had no problems building this project with DUB. However I want to move over to meson so that I can build it for flatpak. I am finding that I am unable to build

Re: @property with opCall

2020-03-10 Thread Calvin P via Digitalmars-d-learn
On Monday, 9 March 2020 at 19:10:54 UTC, Timon Gehr wrote: https://wiki.dlang.org/DIP24 Hi , Timon Gehr Thanks for the reply, very good DIPS. I think this is very basic work, why the core team not take care it for such a long time.

Re: Aliases to mutable thread-local data not allowed

2020-03-10 Thread mark via Digitalmars-d-learn
I just tried: auto jobs = tids.length; while (jobs) { receive( (Deb deb) { debForName[deb.name] = cast(Deb)deb; }, (DoneMessage m) { jobs--; } ); } to cast away the immutable from the se

Re: Aliases to mutable thread-local data not allowed

2020-03-10 Thread mark via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 10:02:16 UTC, Simen Kjærås wrote: [snip] As the error message hints at, the problem is Deb may hold references to data that is shared with other objects on the thread from which it originates. Since you know this is not the case, even if the compiler can't prove it,

Re: Aliases to mutable thread-local data not allowed

2020-03-10 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 08:13:19 UTC, mark wrote: I have this struct: struct Deb { string name; ... Unit[string] tags; // set of tags Deb dup() const { Deb deb; deb.name = name; ... foreach (key; tags.byKey) deb.tags[key] = unit;

Re: Typescript with vibe.d

2020-03-10 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 9 March 2020 at 09:42:16 UTC, GreatSam4sure wrote: I want to know if it is possible to use typescript with the vibe.d since typescript is a superset of javascript. I will appreciate any example if it is possible There's a Diet filter for TypeScript here [1], but it hasn't been upda

Re: New with alias

2020-03-10 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 06:09:23 UTC, tcak wrote: I write a code as below: auto result = new char[4]; It allocates memory as expected. This is a slice of four chars, which can be used as a dynamic array. Later I define an alias and do the above step: alias Pattern = char[4]; This

Aliases to mutable thread-local data not allowed

2020-03-10 Thread mark via Digitalmars-d-learn
I have this struct: struct Deb { string name; ... Unit[string] tags; // set of tags Deb dup() const { Deb deb; deb.name = name; ... foreach (key; tags.byKey) deb.tags[key] = unit; return deb; } } And I want to populate an A