rainwoodman / vast

vala and scientific numerical computation
11 stars 1 forks source link

Terminology (and associated types) #12

Closed arteymix closed 7 years ago

arteymix commented 8 years ago

All this should probably end-up in the wiki.

Dimension

Number of independent axes.

Axis

Index

Offset

Strides

Shape

Scalar

The scalar are the atoms of a dense array.

Raw memory

arteymix commented 8 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.

rainwoodman commented 8 years ago

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.

  1. in 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?

arteymix commented 8 years ago

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
rainwoodman commented 8 years ago

That's a great idea!

arteymix commented 7 years ago

I moved everything into the wiki: https://github.com/rainwoodman/vast/wiki/Types-and-Terminology

I will copy the comment about reshaping in #7.