Re: 2D arrays, slices and manual memory allocation

2022-02-24 Thread 9il via Digitalmars-d-learn
On Friday, 25 February 2022 at 06:03:34 UTC, Nonobvious wrote: From [Go Your Own Way (Part Two: The Heap)](https://dlang.org/blog/2017/09/25/go-your-own-way-part-two-the-heap/): [...] http://mir-algorithm.libmir.org/mir_ndslice_allocation.html#.stdcUninitSlice

Re: I need some help for my DCV update

2021-12-11 Thread 9il via Digitalmars-d-learn
On Saturday, 27 November 2021 at 12:16:39 UTC, Ferhat Kurtulmuş wrote: On Saturday, 27 November 2021 at 11:35:21 UTC, Salih Dincer wrote: I also found similar errors but couldn't solve them. I think it has to do with mir.slice.kind. Exactly Kind Topology... I won't use parallel for it as a

Re: Problem Computing Dot Product with mir

2021-02-22 Thread 9il via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 03:48:15 UTC, Max Haughton wrote: On Monday, 22 February 2021 at 07:14:26 UTC, 9il wrote: On Sunday, 21 February 2021 at 16:18:05 UTC, Kyle Ingraham wrote: I am trying to convert sRGB pixel values to XYZ with mir using the following guide:

Re: Problem Computing Dot Product with mir

2021-02-21 Thread 9il via Digitalmars-d-learn
On Sunday, 21 February 2021 at 16:18:05 UTC, Kyle Ingraham wrote: I am trying to convert sRGB pixel values to XYZ with mir using the following guide: http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html [...] mir-glas is deprecated experimental project. It is worth use mir-blas

Re: Using mir to work with matrices

2021-01-29 Thread 9il via Digitalmars-d-learn
On Friday, 29 January 2021 at 15:35:49 UTC, drug wrote: Between is there a plan to implement some sort of static slice where the lengths of the dimensions are known in compile time? Compiler help is very useful. No. BLAS/LAPACK API's can't use compile-time information. User matrix loops can

Re: Using mir to work with matrices

2021-01-29 Thread 9il via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 14:43:08 UTC, drug wrote: It is not easy to understand what mir library one should use to work with matrices. mir-glas turns out unsupported now and I try to use mir-blas. I need to reimplement my Kalman filter version to use more high dimension matrix than 4x4

Re: mir.algebraic: Visitor cannot be called

2020-12-09 Thread 9il via Digitalmars-d-learn
On Wednesday, 9 December 2020 at 14:34:18 UTC, Andre Pany wrote: Hi, I want to port some Python coding and try have as much similiar coding as possible. I thought I can have a mir variant which stores either class A or B and I can call at runtime a method like this: ``` /+ dub.sdl:

Re: mir.ndslice : multi dimensional associative array - Example/Docs

2020-10-26 Thread 9il via Digitalmars-d-learn
On Monday, 26 October 2020 at 14:31:00 UTC, Vino wrote: Hi All, Is it possible to create a multi dimensional associative array using mir.ndslice, if yes, (1): request you to point me to some example / docs (2): below is an example multi dimensional associative array using the core

Re: Help on asdf json module

2020-10-25 Thread 9il via Digitalmars-d-learn
On Sunday, 25 October 2020 at 06:05:27 UTC, Vino wrote: Hi All, Currently we are testing various json module such as "std.json, std_data_json, vibe.data.json and asdf", the below code works perfectely while use "std_data_json or vibe.data.json" but not working as expected when we use

Re: How to work with and load/save sparse compressed matrices? (numir, mir.sparse)

2020-10-04 Thread 9il via Digitalmars-d-learn
On Tuesday, 29 September 2020 at 04:52:11 UTC, Shaleen Chhabra wrote: I wish to use load / save for sparse compressed matrices using mir. import mir.sparse; auto sp = sparse!double(5, 8); auto crs = sp.compress; How can I save/load sparse compressed arrays in `npz` format?

Re: Red-Black Gauss-seidel with mir

2020-09-14 Thread 9il via Digitalmars-d-learn
On Monday, 14 September 2020 at 09:50:16 UTC, Christoph wrote: Hi Ilya, On Sunday, 13 September 2020 at 19:29:31 UTC, 9il wrote: [...] I have tested it with dmd and ldc and called them just with $ dub build --compiler=ldc(dmd) with no more configurations in the dub.json file. [...] On

Re: Red-Black Gauss-seidel with mir

2020-09-13 Thread 9il via Digitalmars-d-learn
On Sunday, 13 September 2020 at 14:48:30 UTC, Christoph wrote: Hi all, I am trying to implement a sweep method for a 2D Red-black Gauss-Seidel Solver with the help of mir and its slices. The fastest Version I discovered so far looks like this: ``` void sweep(T, size_t Dim : 2, Color color)(in

Re: How to use libmir --> mir-algorithm, numir, mir-random?

2020-09-02 Thread 9il via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 07:01:48 UTC, Shaleen Chhabra wrote: Hi, The libmir libraries can be found here: https://github.com/libmir I wish to use mir-algorithm and numir so that i can directly use .npy format from python and perform the required analysis. I checked out latest

Re: How to sort a multidimensional ndslice?

2020-08-19 Thread 9il via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 13:07:56 UTC, Arredondo wrote: On Tuesday, 18 August 2020 at 04:07:56 UTC, 9il wrote: To reorder the columns data according to precomputed index: auto index = a.byDim!1.map!sum.slice; Hello Ilya, thanks for the answer! Unfortunately I can't use it because I

Re: How to sort a multidimensional ndslice?

2020-08-17 Thread 9il via Digitalmars-d-learn
The following code just sorts each row: -- /+dub.sdl: dependency "mir-algorithm" version="~>3.9.24" +/ import mir.ndslice; import mir.ndslice.sorting; import mir.algorithm.iteration: each; void main() { // fuse, not sliced if you use an array of arrays for argument auto a = [[1,

Re: D Mir: standard deviation speed

2020-07-15 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 11:37:23 UTC, jmh530 wrote: On Wednesday, 15 July 2020 at 11:26:19 UTC, 9il wrote: [snip] @fmamath private double sd(T)(Slice!(T*, 1) flatMatrix) @fastmath violates all summation algorithms except `"fast"`. The same bug is in the original author's post. I

Re: D Mir: standard deviation speed

2020-07-15 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 11:23:00 UTC, jmh530 wrote: On Wednesday, 15 July 2020 at 05:57:56 UTC, tastyminerals wrote: [snip] Here is a (WIP) project as of now. Line 160 in https://github.com/tastyminerals/mir_benchmarks_2/blob/master/source/basic_ops.d std of [60, 60] matrix 0.0389492

Re: D Mir: standard deviation speed

2020-07-15 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 07:34:59 UTC, tastyminerals wrote: On Wednesday, 15 July 2020 at 06:57:21 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:55:51 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:00:46 UTC, tastyminerals wrote: On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il

Re: D Mir: standard deviation speed

2020-07-15 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 06:00:46 UTC, tastyminerals wrote: On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1) flatMatrix) @fastmath shouldn't be really used with summation

Re: D Mir: standard deviation speed

2020-07-15 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 06:55:51 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:00:46 UTC, tastyminerals wrote: On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1)

Re: Question about publishing a useful function I have written

2020-07-14 Thread 9il via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 21:58:49 UTC, Cecil Ward wrote: Does anyone know if this has already been published by someone else? https://github.com/libmir/mir-core/blob/master/source/mir/utility.d#L29 We test LDC and DMC. CI needs an update to be actually tested with GDC.

Re: misc questions about a DUB package

2020-07-14 Thread 9il via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 20:56:06 UTC, DanielG wrote: I have some D-wrapped C libraries I'm considering publishing to DUB, mainly for my own use but also for anybody else who might benefit. I've never done this before so I have some questions: - Should there be any obvious relationship

Re: D Mir: standard deviation speed

2020-07-14 Thread 9il via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1) flatMatrix) @fastmath shouldn't be really used with summation algorithms except the `"fast"` version of them. Otherwise, they

Re: D Mir: standard deviation speed

2020-07-14 Thread 9il via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1) flatMatrix) @fastmath shouldn't be really used with summation algorithms except the `"fast"` version of them. Otherwise, they may or may not behave like "fast".

What is the best CI to test with (almost) latest GDC?

2020-07-14 Thread 9il via Digitalmars-d-learn
For now, Mir doesn't really support GDC. But we want to. Is there are a clear way to get a specific version of GDC. Is there a table of GDC compilers with correspnding DMD FE versions? dlang.org refers to a deprecated page, it is weird.

real.mant_dig on windows?

2020-06-22 Thread 9il via Digitalmars-d-learn
Should it always be 53? or it can be 64, when? Thank you

Re: Mir Slice Column or Row Major

2020-05-27 Thread 9il via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 16:53:37 UTC, jmh530 wrote: On Wednesday, 27 May 2020 at 16:07:58 UTC, welkam wrote: On Wednesday, 27 May 2020 at 01:31:23 UTC, data pulverizer wrote: column major Cute puppies die when people access their arrays in column major. Not always true...many

Re: Mir Slice.shape is not consistent with the actual array shape

2020-05-24 Thread 9il via Digitalmars-d-learn
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote: I am confused by the return value of Mir shape. Consider the following example. /// import std.stdio; import std.conv; import std.array: array; import std.range:

Re: Mir Slice.shape is not consistent with the actual array shape

2020-05-24 Thread 9il via Digitalmars-d-learn
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote: I am confused by the return value of Mir shape. Consider the following example. [...] `sliced` returns a view on the array data, a 1-dimensional slice composed of common D arrays. Try to use `fuse` instead of `sliced`.

Re: How to flatten N-dimensional array?

2020-05-24 Thread 9il via Digitalmars-d-learn
On Saturday, 23 May 2020 at 18:15:32 UTC, Pavel Shkadzko wrote: I have tried to implement a simple flatten function for multidimensional arrays with recursive templates but got stuck. Then I googled a little and stumped into complex https://rosettacode.org/wiki/Flatten_a_list#D implementation

Re: Cross product in lib mir or lubeck

2020-05-01 Thread 9il via Digitalmars-d-learn
On Friday, 1 May 2020 at 11:29:55 UTC, Erdem wrote: Hi, I am looking for cross product function in libmir or lubeck. But I couldn't find it. Does anyone know if it exists or not? Erdem Hi, Libmir doesn't provide cross-product function. Ilya

Re: Why libmir has to add its own algorithm functions

2020-05-01 Thread 9il via Digitalmars-d-learn
On Friday, 1 May 2020 at 11:31:29 UTC, Erdem wrote: As can be seen in the link below : http://mir-algorithm.libmir.org/mir_algorithm_iteration.html Libmir provides almost the same function as std. Why is benefit of doing that? Wouldn't it be better to not duplicate std stuff? Erdem Some

Re: What is the best way to refer to itself when obtaining Substring of a literal?

2020-04-24 Thread 9il via Digitalmars-d-learn
On Saturday, 25 April 2020 at 01:32:54 UTC, 9il wrote: On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable?

Re: What is the best way to refer to itself when obtaining Substring of a literal?

2020-04-24 Thread 9il via Digitalmars-d-learn
On Friday, 24 April 2020 at 22:24:34 UTC, Marcone wrote: I don't want to use lambda. I don't want create variable. What is the best way to refer to itself when obtaining Substring withou using lambda and without create variable? example: writeln("Hello Word!"[x.indexOf(" "), $]); no way

Re: Multiplying transposed matrices in mir

2020-04-19 Thread 9il via Digitalmars-d-learn
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" not working because "a.transposed" is not allocated.

Re: Multiplying transposed matrices in mir

2020-04-19 Thread 9il via Digitalmars-d-learn
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: On Sunday, 19 April 2020 at 19:20:28 UTC, p.shkadzko wrote: [...] Ah, you're right. I use it in other places where it hasn't been an issue. I can do it with an allocation

Re: mir: How to change iterator?

2020-04-19 Thread 9il via Digitalmars-d-learn
On Sunday, 19 April 2020 at 22:07:30 UTC, jmh530 wrote: On Thursday, 16 April 2020 at 20:59:36 UTC, jmh530 wrote: [snip] /+dub.sdl: dependency "mir-algorithm" version="~>3.7.28" +/ import mir.ndslice; void foo(Iterator, SliceKind kind)(Slice!(Iterator, 1, kind) x, Slice!(Iterator, 1, kind)

Re: mir: How to change iterator?

2020-04-18 Thread 9il via Digitalmars-d-learn
On Sunday, 19 April 2020 at 02:56:30 UTC, 9il wrote: On Friday, 17 April 2020 at 08:40:36 UTC, WebFreak001 wrote: On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: [...] Use std.algorithm:equal for range compare with approxEqual for your comparator: assert(equal!approxEqual(y,

Re: mir: How to change iterator?

2020-04-18 Thread 9il via Digitalmars-d-learn
On Friday, 17 April 2020 at 08:40:36 UTC, WebFreak001 wrote: On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: [...] Use std.algorithm:equal for range compare with approxEqual for your comparator: assert(equal!approxEqual(y, [2.5, 2.5].sliced(2))); or mir.algorithm.iteration: each

Re: Linear array to matrix

2020-04-04 Thread 9il 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],

Re: string to char* in betterC

2020-03-11 Thread 9il via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 16:10:48 UTC, 9il wrote: On Wednesday, 11 March 2020 at 16:07:06 UTC, Abby wrote: What is the proper way to get char* from string which is used in c functions? toStringz does returns: /usr/include/dmd/phobos/std/array.d(965,49): Error: TypeInfo cannot be used

Re: string to char* in betterC

2020-03-11 Thread 9il via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 16:07:06 UTC, Abby wrote: What is the proper way to get char* from string which is used in c functions? toStringz does returns: /usr/include/dmd/phobos/std/array.d(965,49): Error: TypeInfo cannot be used with -betterC and I think string.ptr is not safe because

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

2020-03-11 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

Re: Improving dot product for standard multidimensional D arrays

2020-03-02 Thread 9il 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: [...] Matrix multiplication is about cache-friendly

Re: Strange counter-performance in an alternative `decimalLength9` function

2020-02-28 Thread 9il via Digitalmars-d-learn
On Friday, 28 February 2020 at 10:11:23 UTC, Bruce Carneal wrote: On Friday, 28 February 2020 at 06:50:55 UTC, 9il wrote: On Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B. wrote: So after reading the translation of RYU I was interested too see if the decimalLength() function can be

Re: Strange counter-performance in an alternative `decimalLength9` function

2020-02-27 Thread 9il via Digitalmars-d-learn
On Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B. wrote: So after reading the translation of RYU I was interested too see if the decimalLength() function can be written to be faster, as it cascades up to 8 CMP. [...] bsr can be done in one/two CPU operation, quite quick. But

Re: How to sum multidimensional arrays?

2020-02-27 Thread 9il via Digitalmars-d-learn
On Thursday, 27 February 2020 at 23:15:28 UTC, p.shkadzko wrote: And it works effortlessly! Sum of two 5000 x 6000 int arrays is just 0.105 sec! (on a Windows machine though but with weaker CPU). I bet using mir.ndslice instead of D arrays would be even faster. Yes, the output for the

Re: How to sum multidimensional arrays?

2020-02-27 Thread 9il via Digitalmars-d-learn
On Thursday, 27 February 2020 at 16:31:49 UTC, jmh530 wrote: On Thursday, 27 February 2020 at 15:28:01 UTC, p.shkadzko 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

Re: How to sum multidimensional arrays?

2020-02-27 Thread 9il via Digitalmars-d-learn
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.10" +/ import mir.ndslice; import mir.random: threadLocal;

Re: 2D matrix operation (subtraction)

2020-02-22 Thread 9il via Digitalmars-d-learn
On Friday, 21 February 2020 at 13:42:24 UTC, Andre Pany wrote: Mir is great and actually I try to rewrite some Python Pandas Dataframe index logic. Maybe mir.series [1] can work for you. Series!(Key*, Value*) - is a pair of two 1D ndslices, they can be sorted according to the first one

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

2020-01-15 Thread 9il via Digitalmars-d-learn
On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: 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

Re: CI: Why Travis & Circle

2019-11-19 Thread 9il via Digitalmars-d-learn
On Thursday, 14 November 2019 at 13:47:32 UTC, jmh530 wrote: I'm curious what the typical motivation is for using both Travis CI and Circle CI in a project is. Thanks. Circle CI is more flexible but with quite limited free resources.

Re: Is there any writeln like functions without GC?

2019-11-13 Thread 9il via Digitalmars-d-learn
On Sunday, 10 November 2019 at 07:57:38 UTC, dangbinghoo wrote: On Sunday, 3 November 2019 at 05:46:53 UTC, 9il wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module

Re: Is there any writeln like functions without GC?

2019-11-02 Thread 9il via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module https://github.com/libmir/mir-runtime/blob/master/source/mir/format.d

Re: Ranges to deal with corner cases and "random access"

2019-10-05 Thread 9il via Digitalmars-d-learn
On Saturday, 5 October 2019 at 00:38:06 UTC, Brett wrote: Typically a lot of algorithms have corner cases such as referencing elements that end up out of bounds at the start or end (k-c or k+c). [...] mir-algorithm package provides lazy padding and concatenation routines

Re: do mir modules run in parallell

2019-10-05 Thread 9il via Digitalmars-d-learn
On Saturday, 5 October 2019 at 14:51:03 UTC, David wrote: On Saturday, 5 October 2019 at 04:38:34 UTC, 9il wrote: On Friday, 4 October 2019 at 20:32:59 UTC, David wrote: Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David

Re: do mir modules run in parallell

2019-10-04 Thread 9il via Digitalmars-d-learn
On Friday, 4 October 2019 at 20:32:59 UTC, David wrote: Hi I am wondering if MIR modules run in parallel by default or if I can enforce it by a compiler flag? Thanks David Hey David, Do you mean unittests run in parallel or mir algorithms themselves run in parallel? Ilya

Re: Finding Max Value of Column in Multi-Dimesional Array

2019-07-04 Thread 9il via Digitalmars-d-learn
On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

Re: What external libraries are available

2019-06-05 Thread 9il via Digitalmars-d-learn
On Wednesday, 5 June 2019 at 01:20:46 UTC, Mike Brockus wrote: If you never herd about Meson before: 樂. https://mesonbuild.com/ Hay there I was just wondering, what is the D equivalent to C++ Boost and or Poco libraries? Just wondering because I would like to start playing with other

Re: Reuse/reset dynamic rectangular array?

2019-05-27 Thread 9il via Digitalmars-d-learn
On Saturday, 25 May 2019 at 16:17:40 UTC, Robert M. Münch wrote: On 2019-05-25 14:28:24 +, Robert M. Münch said: How can I reset a rectangualr array without having to loop through it? int[][] myRectData = new int[][](10,10); myRectData.length = 0; myRectData[].length = 0;

Re: Example of append & rectangualar arrays?

2019-05-27 Thread 9il via Digitalmars-d-learn
On Saturday, 25 May 2019 at 14:17:43 UTC, Robert M. Münch wrote: Does anyone has an example using Appender with a rectangual array? Appender!(T[][]) can append rows of type T[]. It does not check their lengths, the T[][] is an array of arrays, not a matrix. To append columns one needs an

Re: Impose structure on array

2019-05-26 Thread 9il via Digitalmars-d-learn
On Monday, 20 May 2019 at 12:09:02 UTC, Alex wrote: given some array, is there some way to easily impose structure on that array at runtime? void* data; auto x = cast(byte[A,B,C])data; X is then an AxBxC matrix. I'm having to compute the index myself and it just seems unnecessary. A and B

Re: Memory management by interfacing C/C++

2019-04-29 Thread 9il via Digitalmars-d-learn
On Saturday, 27 April 2019 at 22:25:58 UTC, Ferhat Kurtulmuş wrote: Hi, I am wrapping some C++ code for my personal project (opencvd), and I am creating so many array pointers at cpp side and containing them in structs. I want to learn if I am leaking memory like crazy, although I am not

Re: Unexpected behaviour in associative array

2019-04-20 Thread 9il via Digitalmars-d-learn
On Saturday, 20 April 2019 at 22:16:22 UTC, Arredondo wrote: On Saturday, 20 April 2019 at 14:24:34 UTC, 9il wrote: On Friday, 19 April 2019 at 12:37:10 UTC, Arredondo wrote: Slice!(Contiguous, [2], byte*) payload; BTW, any reason not to use the new version of ndslice? For new API it

Re: Unexpected behaviour in associative array

2019-04-20 Thread 9il via Digitalmars-d-learn
On Friday, 19 April 2019 at 12:37:10 UTC, Arredondo wrote: Slice!(Contiguous, [2], byte*) payload; BTW, any reason not to use the new version of ndslice? For new API it would be: Slice!(byte*, 2, Contiguous) or just Slice!(byte*, 2)

Re: Phobos in BetterC

2019-03-09 Thread 9il via Digitalmars-d-learn
On Saturday, 9 March 2019 at 19:40:27 UTC, Sebastiaan Koppe wrote: On Saturday, 9 March 2019 at 17:14:37 UTC, 9il wrote: It was fixed to be used in BetterC. If it still does not work you can open an issue and ping me (@9il). That is awesome. I suppose support for betterC is only from v3

Re: Phobos in BetterC

2019-03-09 Thread 9il via Digitalmars-d-learn
On Friday, 8 March 2019 at 09:24:25 UTC, Vasyl Teliman wrote: I've tried to use Mallocator in BetterC but it seems it's not available there: https://run.dlang.io/is/pp3HDq This produces a linker error. I'm wondering why Mallocator is not available in this mode (it would be intuitive to

Re: mir.ndslice: assign a vector to a matrix row

2018-12-28 Thread 9il via Digitalmars-d-learn
On Friday, 28 December 2018 at 08:09:09 UTC, 9il wrote: On Thursday, 27 December 2018 at 21:17:48 UTC, David wrote: On Wednesday, 26 December 2018 at 18:59:25 UTC, 9il wrote: On Saturday, 15 December 2018 at 19:04:37 UTC, David wrote: [...] matrix[2][] = vector; Or matrix[2,0..$] =

Re: mir.ndslice: assign a vector to a matrix row

2018-12-28 Thread 9il via Digitalmars-d-learn
On Thursday, 27 December 2018 at 21:17:48 UTC, David wrote: On Wednesday, 26 December 2018 at 18:59:25 UTC, 9il wrote: On Saturday, 15 December 2018 at 19:04:37 UTC, David wrote: Hi I am wondering if it is possible to assign a vector to a row of a matrix? main.d ==

Re: mir.ndslice: assign a vector to a matrix row

2018-12-26 Thread 9il via Digitalmars-d-learn
On Saturday, 15 December 2018 at 19:04:37 UTC, David wrote: Hi I am wondering if it is possible to assign a vector to a row of a matrix? main.d == import mir.ndslice; void main() { auto matrix = slice!double(3, 4); matrix[] = 0; matrix.diagonal[] = 1; auto row

Copyright for reworked Phobos code in Mir

2018-12-26 Thread 9il via Digitalmars-d-learn
Hi folks, I am slightly confused by copyright mess in some of Mir modules. As you may know, some of them contain reworked Phobos functions. Plus I am not sure that I understand the meaning of Copyright in the context that both Phobos and Mir are Boost licensed. For example, currently, I am

Re: updated mir interface

2018-11-07 Thread 9il via Digitalmars-d-learn
On Wednesday, 7 November 2018 at 19:09:50 UTC, Alex wrote: Ok... sorry for being penetrant, but there is still something strange. Having dependencies as you had, [...] Well, fixed in v2.1.3

Re: updated mir interface

2018-11-07 Thread 9il via Digitalmars-d-learn
On Wednesday, 7 November 2018 at 14:46:17 UTC, Alex wrote: On Wednesday, 7 November 2018 at 14:07:32 UTC, 9il wrote: This is a regression. It is fixed in mir-random v2.1.2. Thanks. But I have another one: ´´´ import mir.random.algorithm; import std.experimental.all; void main() {

Re: updated mir interface

2018-11-07 Thread 9il via Digitalmars-d-learn
On Wednesday, 7 November 2018 at 09:33:32 UTC, Alex wrote: I'm referring to the example http://docs.random.dlang.io/latest/mir_random_algorithm.html#.sample [...] This is a regression. It is fixed in mir-random v2.1.2.

Re: Can I create static c callable library?

2018-09-25 Thread 9il via Digitalmars-d-learn
On Tuesday, 25 September 2018 at 11:03:11 UTC, John Burton wrote: I need to write a library to statically link into a c program. Can I write this library in D? Will I be able to use proper D abilities like gc? Obviously the public interface will need to be basic c callable functions... I

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-09-10 Thread 9il via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 09:23:49 UTC, kerdemdemir wrote: I need a classifier in my project. Since it is I believe most easy to implement I am trying to implement logistic regression. [...] Mir Random v1.0.0 has new `range` overloads that can work NdRandomVariable. Example:

Re: How to use math functions in dcompute?

2018-08-27 Thread 9il via Digitalmars-d-learn
On Monday, 27 August 2018 at 09:57:18 UTC, Sobaya wrote: On Monday, 27 August 2018 at 09:41:34 UTC, 9il wrote: On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote: I'm using dcompute(https://github.com/libmir/dcompute). In the development, I have got to use math functions such as sqrt in

Re: How to use math functions in dcompute?

2018-08-27 Thread 9il via Digitalmars-d-learn
On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote: I'm using dcompute(https://github.com/libmir/dcompute). In the development, I have got to use math functions such as sqrt in @compute function. But LDC says "can only call functions from other @compute modules in @compute code", so

Re: Error calling geqrs function from lubeck package.

2018-07-05 Thread 9il via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 03:26:25 UTC, Jamie wrote: I'm attempting to use the lubeck package, as described here https://forum.dlang.org/post/axacgiisczwvygyef...@forum.dlang.org I have lubeck, mir-algorithm, mir-blas, mir-lapack downloaded and accessible by the compiler, and I have

Re: Help using lubeck on Windows

2018-07-03 Thread 9il via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 00:23:36 UTC, 9il wrote: On Sunday, 25 February 2018 at 14:26:24 UTC, Arredondo wrote: On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: [...] It is not working my friend. I've been at this for nearly two full days now. All the .lib/.a files I

Re: Help using lubeck on Windows

2018-07-03 Thread 9il via Digitalmars-d-learn
On Sunday, 25 February 2018 at 14:26:24 UTC, Arredondo wrote: On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: openblas.net contains precompiled openblas library for Windows. It may not be optimised well for exactly your CPU but it is fast enought to start. Put the library

Re: Docs for subpackages?

2018-06-13 Thread 9il via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 14:56:10 UTC, 9il wrote: Hi, I am trying to build a large project that is split into dozen of sub-packages. How I can do it using dub without writing my own doc scripts? --combined does not help here. Best regards, Ilya UPDATE: --combined works, but DDOX fails

Docs for subpackages?

2018-06-13 Thread 9il via Digitalmars-d-learn
Hi, I am trying to build a large project that is split into dozen of sub-packages. How I can do it using dub without writing my own doc scripts? --combined does not help here. Best regards, Ilya

Re: How/where to hack DMD to generate docs for string mixed members.

2018-04-16 Thread 9il via Digitalmars-d-learn
On Sunday, 15 April 2018 at 08:17:21 UTC, Jonathan M Davis wrote: On Sunday, April 15, 2018 07:59:17 Stefan Koch via Digitalmars-d-learn wrote: On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote: > Hey, > > How/where to hack DMD to generate docs for string mixed > members? > > struct S > { >

Re: How/where to hack DMD to generate docs for string mixed members.

2018-04-16 Thread 9il via Digitalmars-d-learn
On Sunday, 15 April 2018 at 07:59:17 UTC, Stefan Koch wrote: On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote: Hey, How/where to hack DMD to generate docs for string mixed members? struct S { mixin(" /// auto bar() {} "); } Best regards, Ilya Yaroshenko hmm you

How/where to hack DMD to generate docs for string mixed members.

2018-04-14 Thread 9il via Digitalmars-d-learn
Hey, How/where to hack DMD to generate docs for string mixed members? struct S { mixin(" /// auto bar() {} "); } Best regards, Ilya Yaroshenko

Re: .sort vs sort(): std.algorithm not up to the task?

2017-06-08 Thread 9il via Digitalmars-d-learn
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote: Ranges may be finite or infinite but, while the destination may be unreachable, we can definitely tell how far we've traveled. So why doesn't this work? import std.traits; import std.range; void main() { string[string] aa;

Re: Guide - Migrating from std.experimental.ndslice to mir-algorithm

2017-06-02 Thread 9il via Digitalmars-d-learn
On Friday, 2 June 2017 at 16:08:20 UTC, Zz wrote: Hi, Just tried migrating from std.experimental.ndslice to mir-algorithm. Is there a guide on how migrate old code? I used the following imports before and using then with ndslice. import std.experimental.ndslice; import std.algorithm :

Re: templatized delegate

2017-05-23 Thread 9il via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote: On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote: With that kind of variadics, you're not dealing with a template. A (run-time) variadic delegate is an actual delegate, i.e. a value that can be passed around. But the variadic stuff is

Re: "Rolling Hash computation" or "Content Defined Chunking"

2017-05-09 Thread 9il via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 18:17:45 UTC, notna wrote: I hoped there may already be something in Mir or Weka.io or somewhere else... Will read the Golang, C and C++ source and see if my Dlang is good enough for ranges and the like magic... Hello notha, You may want to open a PR to

Re: ndslice summary please

2017-04-13 Thread 9il via Digitalmars-d-learn
On Thursday, 13 April 2017 at 15:22:46 UTC, Martin Tschierschke wrote: On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is

Re: ndslice summary please

2017-04-13 Thread 9il via Digitalmars-d-learn
On Thursday, 13 April 2017 at 15:22:46 UTC, Martin Tschierschke wrote: On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is

Re: ndslice summary please

2017-04-13 Thread 9il via Digitalmars-d-learn
On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is Ilya or someone else rewriting it? Ali The reasons to use

Re: ndslice summary please

2017-04-13 Thread 9il via Digitalmars-d-learn
On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is Ilya or someone else rewriting it? Ali Hello Ali, ndslice was

Re: Why doesn't this chain of ndslices work?

2016-05-15 Thread 9il via Digitalmars-d-learn
On Saturday, 14 May 2016 at 21:59:48 UTC, Stiff wrote: Here's the code that doesn't compile: import std.stdio, std.experimental.ndslice, std.range, std.algorithm; [...] Coming soon https://github.com/libmir/mir/issues/213#issuecomment-219271447 --Ilya

Re: foreach(i,ref val; ndim_arr)??

2016-05-10 Thread 9il via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 15:18:50 UTC, ZombineDev wrote: On Tuesday, 10 May 2016 at 10:21:30 UTC, ZombineDev wrote: (You can try it at: https://dpaste.dzfl.pl/c0327f067fca) import std.array : array; import std.experimental.ndslice : byElement, indexSlice, sliced; import std.range : iota,

Re: foreach(i,ref val; ndim_arr)??

2016-05-10 Thread 9il via Digitalmars-d-learn
On Monday, 9 May 2016 at 18:50:32 UTC, Jay Norwood wrote: I noticed some discussion of Cartesian indexes in Julia, where the index is a tuple, along with some discussion of optimizing the index created for cache efficiency. I could find foreach(ref val, m.byElement()), but didn't find an

Re: Issue with 2.071: Regression or valid error?

2016-04-08 Thread 9il via Digitalmars-d-learn
On Thursday, 7 April 2016 at 15:55:16 UTC, Steven Schveighoffer wrote: On 4/6/16 11:10 AM, Andre wrote: [...] Just FYI, you don't need a semicolon there. [...] Wow, totally agree with you. Compiler shouldn't make you jump through this hoop: void foo(Cat cat) { Animal a = cat;