Re: Beginner's Comparison Benchmark

2020-05-06 Thread p.shkadzko via Digitalmars-d-learn
On Tuesday, 5 May 2020 at 20:07:54 UTC, RegeleIONESCU wrote: [...] Python should be ruled out, this is not its war :) I have done benchmarks against NumPy if you are interested: https://github.com/tastyminerals/mir_benchmarks

Re: Multiplying transposed matrices in mir

2020-04-20 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 20 April 2020 at 02:50:29 UTC, 9il wrote: On Monday, 20 April 2020 at 02:42:33 UTC, 9il wrote: On Sunday, 19 April 2020 at 20:29:54 UTC, p.shkadzko wrote: On Sunday, 19 April 2020 at 20:06:23 UTC, jmh530 wrote: [...] Thanks. I somehow missed the whole point of "a * a.transposed"

Re: Multiplying transposed matrices in mir

2020-04-20 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 19 April 2020 at 21:27:43 UTC, jmh530 wrote: On Sunday, 19 April 2020 at 20:29:54 UTC, p.shkadzko wrote: [snip] Thanks. I somehow missed the whole point of "a * a.transposed" not working because "a.transposed" is not allocated. a.transposed is just a view of the original matrix. E

Re: Multiplying transposed matrices in mir

2020-04-19 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 19 April 2020 at 20:06:23 UTC, jmh530 wrote: On Sunday, 19 April 2020 at 19:20:28 UTC, p.shkadzko wrote: [snip] well no, "assumeContiguous" reverts the results of the "transposed" and it's "a * a". I would expect it to stay transposed as NumPy does "assert np.all(np.ascontiguous(a.T

Re: Multiplying transposed matrices in mir

2020-04-19 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 19 April 2020 at 19:13:14 UTC, p.shkadzko wrote: On Sunday, 19 April 2020 at 18:59:00 UTC, jmh530 wrote: On Sunday, 19 April 2020 at 17:55:06 UTC, p.shkadzko wrote: snip So, lubeck mtimes is equivalent to NumPy "a.dot(a.transpose())". There are elementwise operation on two matric

Re: Multiplying transposed matrices in mir

2020-04-19 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 19 April 2020 at 18:59:00 UTC, jmh530 wrote: On Sunday, 19 April 2020 at 17:55:06 UTC, p.shkadzko wrote: snip So, lubeck mtimes is equivalent to NumPy "a.dot(a.transpose())". There are elementwise operation on two matrices of the same size and then there is matrix multiplication.

Re: Multiplying transposed matrices in mir

2020-04-19 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 19 April 2020 at 17:22:12 UTC, jmh530 wrote: On Sunday, 19 April 2020 at 17:07:36 UTC, p.shkadzko wrote: I'd like to calculate XX^T where X is some [m x n] matrix. // create a 3 x 3 matrix Slice!(double*, 2LU) a = [2.1, 1.0, 3.2, 4.5, 2.4, 3.3, 1.5, 0, 2.1].sliced(3, 3); auto b = a

Multiplying transposed matrices in mir

2020-04-19 Thread p.shkadzko via Digitalmars-d-learn
I'd like to calculate XX^T where X is some [m x n] matrix. // create a 3 x 3 matrix Slice!(double*, 2LU) a = [2.1, 1.0, 3.2, 4.5, 2.4, 3.3, 1.5, 0, 2.1].sliced(3, 3); auto b = a * a.transposed; // error Looks like it is not possible due to "incompatible types for (a) * (transposed(a)): Slice!

Re: .get refuses to work on associative array

2020-04-15 Thread p.shkadzko via Digitalmars-d-learn
On Wednesday, 15 April 2020 at 22:09:32 UTC, H. S. Teoh wrote: On Wed, Apr 15, 2020 at 09:46:58PM +, p.shkadzko via Digitalmars-d-learn wrote: [...] Are you sure the error is on the line you indicated? The error message claims that your argument types are (double[string], string, string

.get refuses to work on associative array

2020-04-15 Thread p.shkadzko via Digitalmars-d-learn
I am quite confused by the following exception during dub build: dub build --single demo.d --compiler=ldc2 --force Performing "debug" build using ldc2 for x86_64. demo ~master: building configuration "application"... demo.d(221,20): Error: template object.get cannot deduce function from argume

Re: How to correctly import tsv-utilites functions?

2020-04-14 Thread p.shkadzko via Digitalmars-d-learn
On Tuesday, 14 April 2020 at 20:05:28 UTC, Steven Schveighoffer wrote: On 4/14/20 3:34 PM, p.shkadzko wrote: [...] What about using dependency tsv-utils:common ? Looks like tsv-utils is a collection of subpackages, and the main package just serves as a namespace. -Steve Yes, it works! T

How to correctly import tsv-utilites functions?

2020-04-14 Thread p.shkadzko via Digitalmars-d-learn
I need to use "bufferedByLine" function from "tsv-utilities" package located: https://github.com/eBay/tsv-utils/blob/master/common/src/tsv_utils/common/utils.d I have the following dub config /+ dub.sdl: name "demo" dependency "tsv-utils" version="~>1.6.0" dflags-ldc "-mcpu=native"

Re: Linear array to matrix

2020-04-05 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 5 April 2020 at 18:58:17 UTC, p.shkadzko wrote: On Saturday, 4 April 2020 at 09:25:14 UTC, Giovanni Di Maria wrote: [...] Why not use "chunks" from std.range? import std.range: chunks; void main() { int[] arr = [10,20,30,40,50,60,70,80,90,100,110,120]; auto matrix1 = arr.c

Re: Linear array to matrix

2020-04-05 Thread p.shkadzko via Digitalmars-d-learn
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 [10,20,30,40,50,60,70,80,90,100,110,120]; To [ [10,20,30], [40,50,60], [70,80,90], [100,110,1

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread p.shkadzko via Digitalmars-d-learn
On Friday, 27 March 2020 at 13:10:00 UTC, jmh530 wrote: On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipul

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread p.shkadzko via Digitalmars-d-learn
On Friday, 27 March 2020 at 11:19:06 UTC, WebFreak001 wrote: On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: [...] I don't really know mir myself, but for the start of the content: [...] Ok, looks like I need to reread the slices topic. It always confused me especially when i

Blog post about multidimensional arrays in D

2020-03-27 Thread p.shkadzko via Digitalmars-d-learn
I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipulations with them. It started with a small file with snippets for personal use but then kind of escalated into an idea

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: Improving dot product for standard multidimensional D arrays

2020-03-03 Thread p.shkadzko via Digitalmars-d-learn
On Tuesday, 3 March 2020 at 10:25:27 UTC, maarten van damme wrote: it is difficult to write an efficient matrix matrix multiplication in any language. If you want a fair comparison, implement your naive method in python and compare those timings. Op di 3 mrt. 2020 om 04:20 schreef 9il via Digi

Re: Improving dot product for standard multidimensional D arrays

2020-03-02 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 2 March 2020 at 20:56:50 UTC, jmh530 wrote: On Monday, 2 March 2020 at 20:22:55 UTC, p.shkadzko wrote: [snip] Interesting growth of processing time. Could it be GC? +--+-+ | matrixDotProduct | time (sec.) | +--+-+ | 2x[100 x 10

Re: Improving dot product for standard multidimensional D arrays

2020-03-02 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 1 March 2020 at 20:58:42 UTC, p.shkadzko wrote: Hello again, Thanks to previous thread on multidimensional arrays, I managed to play around with pure D matrix representations and even benchmark a little against numpy: [...] Interesting growth of processing time. Could it be GC?

Re: Improving dot product for standard multidimensional D arrays

2020-03-02 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 2 March 2020 at 15:00:56 UTC, jmh530 wrote: On Monday, 2 March 2020 at 13:35:15 UTC, p.shkadzko wrote: [snip] Thanks. I don't have time right now to review this thoroughly. My recollection is that the dot product of two matrices is actually matrix multiplication, correct? It gener

Re: Improving dot product for standard multidimensional D arrays

2020-03-02 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 2 March 2020 at 11:33:25 UTC, jmh530 wrote: On Sunday, 1 March 2020 at 20:58:42 UTC, p.shkadzko wrote: Hello again, [snip] What compiler did you use and what flags? Ah yes, sorry. I used latest ldc2 (1.20.0-x64) for Windows. Dflags -mcpu=native and "inline", "optimize", "release

Improving dot product for standard multidimensional D arrays

2020-03-01 Thread p.shkadzko via Digitalmars-d-learn
Hello again, Thanks to previous thread on multidimensional arrays, I managed to play around with pure D matrix representations and even benchmark a little against numpy: +-++---+ | benchma

Re: How to sum multidimensional arrays?

2020-02-29 Thread p.shkadzko via Digitalmars-d-learn
On Friday, 28 February 2020 at 16:51:10 UTC, AB wrote: On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote: [...] Your Example with a minimal 2D array. module test2; import std.random : Xorshift, unpredictableSeed, uniform; import std.range : generate, take, chunks;

Re: How to sum multidimensional arrays?

2020-02-27 Thread p.shkadzko via Digitalmars-d-learn
On Thursday, 27 February 2020 at 15:48:53 UTC, bachmeier wrote: On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote: [...] This works but it does not look very efficient considering we flatten and then calling array twice. It will get even worse with 3D arrays. Is there a better w

Re: How to sum multidimensional arrays?

2020-02-27 Thread p.shkadzko via Digitalmars-d-learn
On Thursday, 27 February 2020 at 16:31:07 UTC, 9il wrote: On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote: Is there a better way without relying on mir.ndslice? ndslice Poker Face /+dub.sdl: dependency "mir-algorithm" version="~>3.7.17" dependency "mir-random" version="~>2.2.1

Re: How to sum multidimensional arrays?

2020-02-27 Thread p.shkadzko via Digitalmars-d-learn
On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote: This works but it does not look very efficient considering we flatten and then calling array twice. It will get even worse with 3D arrays. And yes, benchmarks show that summing 2D arrays like in the example above is significantl

How to sum multidimensional arrays?

2020-02-27 Thread p.shkadzko via Digitalmars-d-learn
I'd like to sum 2D arrays. Let's create 2 random 2D arrays and sum them. ``` import std.random : Xorshift, unpredictableSeed, uniform; import std.range : generate, take, chunks; import std.array : array; static T[][] rndMatrix(T)(T max, in int rows, in int cols) { Xorshift rnd; rnd.seed

Re: books for learning D

2020-01-30 Thread p.shkadzko via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 08:56:26 UTC, rumbu wrote: On Wednesday, 29 January 2020 at 08:40:48 UTC, p.shkadzko wrote: Has anyone read "d programming language tutorial: A Step By Step Appoach: Learn d programming language Fast"? https://www.goodreads.com/book/show/38328553-d-programming-

Re: books for learning D

2020-01-29 Thread p.shkadzko via Digitalmars-d-learn
Has anyone read "d programming language tutorial: A Step By Step Appoach: Learn d programming language Fast"? https://www.goodreads.com/book/show/38328553-d-programming-language-tutorial?from_search=true&qid=G9QIeXioOJ&rank=3

Re: How to create meson.build with external libs?

2020-01-14 Thread p.shkadzko via Digitalmars-d-learn
On Tuesday, 14 January 2020 at 20:14:30 UTC, p.shkadzko wrote: On Tuesday, 14 January 2020 at 15:15:09 UTC, Rasmus Thomsen wrote: On Tuesday, 14 January 2020 at 09:54:18 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 21:15:51 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 20:53:43

Re: How to create meson.build with external libs?

2020-01-14 Thread p.shkadzko via Digitalmars-d-learn
On Tuesday, 14 January 2020 at 15:15:09 UTC, Rasmus Thomsen wrote: On Tuesday, 14 January 2020 at 09:54:18 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 21:15:51 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 20:53:43 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 19:56:35 U

Re: How to create meson.build with external libs?

2020-01-14 Thread p.shkadzko via Digitalmars-d-learn
On Tuesday, 14 January 2020 at 11:26:30 UTC, Andre Pany wrote: On Tuesday, 14 January 2020 at 09:54:18 UTC, p.shkadzko wrote: [...] May I ask, whether you have tried to use Dub, or is s.th. blocking you from using Dub? Kind regards André I tested dub and it fetched and compiled mir.ndslic

Re: How to create meson.build with external libs?

2020-01-14 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 21:15:51 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 20:53:43 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 19:56:35 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: [...] I had to set PKG_CONFIG_PATH to "/usr/

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 20:53:43 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 19:56:35 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: [...] I had to set PKG_CONFIG_PATH to "/usr/local/lib/pkgconfig". For some reason Manjaro distro doesn't h

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 19:56:35 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will _

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

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
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 openblas package installed. The Lubeck library depends on CB

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will _not_ auto-download required software for you. You have to ways

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will _not_ auto-download required software for you. You have to ways to go forward with this: [...] I followed the 1 step, name

Re: How to create meson.build with external libs?

2020-01-12 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will _not_ auto-download required software for you. You have to ways to go forward with this: [...] Thanks! I shall try it out.

Re: How to create meson.build with external libs?

2020-01-12 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: What do I need to do in order to build the project with "lubeck" dependency in meson? In difference to dub, meson will _not_ auto-download required software for you.

How to create meson.build with external libs?

2020-01-12 Thread p.shkadzko via Digitalmars-d-learn
Ok, I am trying to meson and is struggling with meson.build file. I looked up the examples page: https://github.com/mesonbuild/meson/tree/master/test%20cases/d which has a lot of examples but not the one that shows you how to build your project with some external dependency :) Let's say we ha

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

2020-01-11 Thread p.shkadzko via Digitalmars-d-learn
I am trying to run example code from https://tour.dlang.org/tour/en/dub/lubeck example.d: --- /+dub.sdl: dependency "lubeck" version="~>1.1" +/ import lubeck: mtimes; import mir.algorithm.iteration: each; import mir.ndslice; import std.stdio: writeln; void main() { auto n = 5; // Magic

Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-29 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 29 December 2019 at 14:41:46 UTC, Russel Winder wrote: The more the D community advertise that IDEs are for wimps, the less likelihood that people will come to D usage. It is so. And yet, I can't use Java or Scala without IDE and I tried. I believe the same is true for C++.

Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-28 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 22 December 2019 at 17:20:51 UTC, BoQsc wrote: There are lots of editors/IDE's that support D language: https://wiki.dlang.org/Editors What kind of editor/IDE are you using and which one do you like the most? Tried almost all of them that support D including Dlang IDE, Dexed, Pos