On Tuesday, 9 June 2015 at 08:50:16 UTC, John Colvin wrote:
On Tuesday, 9 June 2015 at 06:59:07 UTC, Andrei Alexandrescu
wrote:
On 6/8/15 8:26 PM, Ilya Yaroshenko wrote:
On Sunday, 7 June 2015 at 18:27:16 UTC, Robert burner Schadek
wrote:
Phobos is awesome, the libs of go, python and rust only have
better
marketing.
As discussed on dconf, phobos needs to become big and blow
the rest
out of the sky.
http://wiki.dlang.org/DIP80
lets get OT, please discuss
There are
https://github.com/9il/simple_matrix and
https://github.com/9il/cblas .
I will try to rework them for Phobos.
Any ideas and suggestions?
Some notes about portability:
1. OS X has Accelerated framework builtin.
2. Linux has blast by default or it can be easily
installed. However
default blast is very slow. The openBLAS is preferred.
3. Looks like there is no simple way to have BLAS support
on Windows.
Should we provide BLAS library with DMD for Windows and maybe
Linux?
I think licensing matters would make this difficult. What I do
think we can do is:
(a) Provide standard data layouts in std.array for the typical
shapes supported by linear algebra libs: row major, column
major, alongside with striding primitives.
I don't think this is quite the right approach.
Multidimensional arrays and matrices are about accessing and
iteration over data, not data structures themselves. The
standard layouts are common special cases.
Probably we need both approaches:
[1]. Multidimensional random access slices (ranges, not only
arrays)
We can do it easily:
size_t anyNumber;
auto ar = new int[3 * 8 * 9 + anyNumber];
auto slice = Slice[0..3, 4..8, 1..9];
assert(ar.canBeSlicedWith(slice)); //checks that ar.length <= 3 *
8 * 9
auto tensor = ar.sliced(slice);
tensor[0, 1, 2] = 4;
auto matrix = tensor[0..$, 1, 0..$];
assert(matrix[0, 2] == 4);
[2]. BLAS Transposed.no/yes and Major.row/column (naming can be
changed) flags for plain 2D matrixes based on
2.1 D arrays (both GC and manual memory management)
2.2 std.container.array (RefCounted)
RowMajor and RowMinor are not needed if Transposed is already
defined. But this stuff helps engineers implement software in
terms of corresponding mathematical documentation.
I hope to create @nogc versions for 2.1 and 2.2 (because GC is
not needed for slices).
Furthermore [2] can be based on [1].
(b) Provide signatures for C and Fortran libraries so people
who have them can use them easily with D.
(c) Provide high-level wrappers on top of those functions.
Andrei
That is how e.g. numpy works and it's OK, but D can do better.
Ilya, I'm very interested in discussing this further with you.
I have a reasonable idea and implementation of how I would want
the generic n-dimensional types in D to work, but you seem to
have more experience with BLAS and LAPACK than me* and of
course interfacing with them is critical.
*I rarely interact with them directly.
John, please describe your ideas and use cases. I think github
issues is more convenient place. You have opened
https://github.com/kyllingstad/scid/issues/24 . So I think we can
past our code examples at SciD issue.