Closed arteymix closed 7 years ago
Just to mention, all the size_t
and ssize_t
are refeering to gsize
and gssize
as described in https://developer.gnome.org/glib/stable/glib-Basic-Types.html They are alias with introspection.
1.In general offset
could be negative. I know it is impossible if it is GBytes. If it turns out necessary we can always flip.
numpy
, the argument newshape
to reshape(newshape)
is signed. If a newshape is [-1] it will be automatically inferred from the total size and the non -1
elements. Very handy feature. but it means sometimes shape can be ssize_t
too.Would it hurt if we make all offsets / shapes are ssize_t?
I like to keep everything unsigned internally and signed externally to compute reverse offset/index.
We never really expose offsets, only via indexes which are already signed.
For reshape
wouldn't it be nicer to fill smallest size first? Instead of having -1
for inferred dimension, we could have something like size_t.MAX
for unconstrained axes.
arr.reshape ({2, 2, size_t.MAX}); // fill 2 by 2 and as much as possible in the last axis
That's a great idea!
I moved everything into the wiki: https://github.com/rainwoodman/vast/wiki/Types-and-Terminology
I will copy the comment about reshaping in #7.
All this should probably end-up in the wiki.
Dimension
Number of independent axes.
dimension
issize_t
as it defines the size ofstrides
andshape
Axis
ssize_t
from the outside world for negative indexingsize_t
internally for indexingstrides
andshape
Index
ssize_t[]
to allow negative indexingsize_t
offset using strides and shapeOffset
size_t
to index the raw memoryStrides
ssize_t[]
to allow negative indexingShape
size_t[]
as it define the length of each axesScalar
The scalar are the atoms of a dense array.
scalar_size
is asize_t
scalar_type
is aGType
Raw memory
GBytes
that wraps auint8[]
array