Re: N-dimensional slices is ready for comments!

2015-06-19 Thread Vlad Levenfeld via Digitalmars-d-announce

On Friday, 19 June 2015 at 10:13:42 UTC, Ilya Yaroshenko wrote:

On Friday, 19 June 2015 at 01:46:05 UTC, jmh530 wrote:

On Monday, 15 June 2015 at 08:40:31 UTC, Ilya Yaroshenko wrote:

Hi All,

PR and Examples: 
https://github.com/D-Programming-Language/phobos/pull/3397

DUB http://code.dlang.org/packages/dip80-ndslice

N-dimensional slices is real world example where `static 
foreach` would be useful.

Corresponding lines was marked with //TODO: static foreach

Best regards,
Ilya


The operator overloading and slicing mechanics look great, but 
I'm probably more excited about the future work you have 
listed.


Some thoughts:
The top line of ndslice.d says it is for creating 
n-dimensional random access ranges. I was able to get the 
example for operator overloading working for dynamic arrays, 
but it doesn't seem to work for static. Hopefully this work 
can be extended. In addition, hopefully the future work on 
foreach byElement will be able to work on static arrays in 
addition to dynamic.




You can slice fixed size arrays:


auto myFun()
{
 float[4096] data;
 auto tensor = data[].sliced(256, 16);
 ///use tensor
}

My second point seems to be related to a discussion on the 
github page about accessing N-dimensional arrays by index. 
Basically there are some circumstances where it is convenient 
to loop by index on an N-dimensional array.




Denis had the same concept already implemented in his `unstd` 
library.

So, ndslice is going to have it too.


Finally, I have been trying to do something like
auto A = 4.iota.sliced(2, 2).array;
auto B = to!(float[][])(A);
without any luck. Seems to work though for one-dimensional 
arraays. I think instead you have to do something like

auto A = iota(0.0f, 4.0f, 1).sliced(2, 2).array;


Thanks!
I will add this kind of functionality:

auto A = 4.iota.sliced(2, 2);
auto B = cast(float[][]) A;

import std.conv;
auto C = A.to!(float[][]); //calls opCast


https://github.com/evenex/autodata

N-dimensional slicing, range ops (map, zip, repeat, cycle, etc) 
lifted to n-dimensions, n-dim specific ops like extrusion, n-dim 
to d-dim of n-1-dim, flattening for lexicographic traversal, 
support for non-integer indices. I posted this awhile ago but no 
one took notice. But if this is happening here now, feel free to 
crib anything that you think might look useful, as I'd hate to 
think all of this prior work went to waste.


Walter, Brian, and Daniel's DConf 2015 talks are up

2015-06-19 Thread Brad Anderson via Digitalmars-d-announce

Walter: https://www.youtube.com/watch?v=znjesAXEEqw
Brian: https://www.youtube.com/watch?v=FmFyB9e7edw
Daniel: https://www.youtube.com/watch?v=5daHGXSetXk

I've only just started watching but the editing seems to be well 
done so thanks to UVU for that.


Re: N-dimensional slices is ready for comments!

2015-06-19 Thread Vlad Levenfeld via Digitalmars-d-announce

On Friday, 19 June 2015 at 21:43:59 UTC, Vlad Levenfeld wrote:

https://github.com/evenex/autodata

N-dimensional slicing, range ops (map, zip, repeat, cycle, etc) 
lifted to n-dimensions, n-dim specific ops like extrusion, 
n-dim to d-dim of n-1-dim, flattening for lexicographic 
traversal, support for non-integer indices. I posted this 
awhile ago but no one took notice. But if this is happening 
here now, feel free to crib anything that you think might look 
useful, as I'd hate to think all of this prior work went to 
waste.


and the dub package: http://code.dlang.org/packages/autodata


Re: N-dimensional slices is ready for comments!

2015-06-19 Thread Ilya Yaroshenko via Digitalmars-d-announce

On Friday, 19 June 2015 at 01:46:05 UTC, jmh530 wrote:

On Monday, 15 June 2015 at 08:40:31 UTC, Ilya Yaroshenko wrote:

Hi All,

PR and Examples: 
https://github.com/D-Programming-Language/phobos/pull/3397

DUB http://code.dlang.org/packages/dip80-ndslice

N-dimensional slices is real world example where `static 
foreach` would be useful.

Corresponding lines was marked with //TODO: static foreach

Best regards,
Ilya


The operator overloading and slicing mechanics look great, but 
I'm probably more excited about the future work you have listed.


Some thoughts:
The top line of ndslice.d says it is for creating 
n-dimensional random access ranges. I was able to get the 
example for operator overloading working for dynamic arrays, 
but it doesn't seem to work for static. Hopefully this work can 
be extended. In addition, hopefully the future work on foreach 
byElement will be able to work on static arrays in addition to 
dynamic.




You can slice fixed size arrays:


auto myFun()
{
 float[4096] data;
 auto tensor = data[].sliced(256, 16);
 ///use tensor
}

My second point seems to be related to a discussion on the 
github page about accessing N-dimensional arrays by index. 
Basically there are some circumstances where it is convenient 
to loop by index on an N-dimensional array.




Denis had the same concept already implemented in his `unstd` 
library.

So, ndslice is going to have it too.


Finally, I have been trying to do something like
auto A = 4.iota.sliced(2, 2).array;
auto B = to!(float[][])(A);
without any luck. Seems to work though for one-dimensional 
arraays. I think instead you have to do something like

auto A = iota(0.0f, 4.0f, 1).sliced(2, 2).array;


Thanks!
I will add this kind of functionality:

auto A = 4.iota.sliced(2, 2);
auto B = cast(float[][]) A;

import std.conv;
auto C = A.to!(float[][]); //calls opCast