Do we need Mat, Vec, TMmat, Diag, Sym and other matrix types?
9il
ilyayaroshenko at gmail.com
Tue Mar 13 03:37:36 UTC 2018
Hi All,
The Dlang multidimensional range type, ndslice, is a struct
composed a an iterator, lengths and possibly strides. It does not
own memory and does not know anything about its content. ndslice
is a faster and extended version of numpy.ndarray.
After some work on commercial projects based on Lubeck[1] and
ndslice I figure out what API and memory management is required
to make Dlang super fast and math friendly in the same time.
The concept is the following:
1. All memory is managed by a global BetterC thread safe ARC
allocator. Optionally the allocator can be overloaded.
2. User can take an internal ndslice to use mir.ndslice API
internally in functions.
2. auto matrixB = matrixA; // increase ARC
3. auto matrixB = matrixA.dup; // allocates new matrix
4. matrix[i] returns a Vec and increase ARC, matrix[i, j] returns
a content of the cell.
5. Clever `=` expression based syntax. For example:
// performs CBLAS call of GEMM and does zero memory allocations
C = alpha * A * B + beta * C;
`Mat` and other types will support any numeric types, PODlike
structs, plus special overload for `bool` based on `bitwise` [2].
I have a lot of work for next months, but looking for a good
opportunity to make Mat happen.
For contributing or co-financing:
Ilya Yaroshenko at
gmail com
Best Regards,
Ilya
[1] https://github.com/kaleidicassociates/lubeck
[2]
http://docs.algorithm.dlang.io/latest/mir_ndslice_topology.html#bitwise
[3]
http://www.netlib.org/lapack/explore-html/d1/d54/group__double__blas__level3_gaeda3cbd99c8fb834a60a6412878226e1.html#gaeda3cbd99c8fb834a60a6412878226e1
More information about the Digitalmars-d
mailing list