rainwoodman / vast

vala and scientific numerical computation
11 stars 1 forks source link

Scalar and caching data.get_data(). #27

Closed rainwoodman closed 7 years ago

rainwoodman commented 7 years ago

Making use of construct block to allocate a default buffer for data when not provided.

rainwoodman commented 7 years ago

@arteymix take a look at this approach. on #26 and #24

arteymix commented 7 years ago

I already did the data pointer caching in 3e5229a4d1ab1b577cc1a96498da03534f09c8db. Instead we can work origin out in this PR.

rainwoodman commented 7 years ago

An array can have a dimension with shape of zero. It doesn't collapse the whole array -- size will be zero, but the shape on other axes are still valid.

Extending the domain to shape[d] == 0 closes some corner cases. as an exampe, in numpy I do use zero length arrays as the first element of a list of array to be concatenated, to ensure the dimension of the result is correct even if the list would otherwise be empty.

On Fri, Dec 2, 2016 at 2:41 PM, Guillaume Poirier-Morency < notifications@github.com> wrote:

@arteymix commented on this pull request.

In src/array.vala https://github.com/rainwoodman/vast/pull/27#pullrequestreview-11254116:

@@ -77,14 +83,13 @@ public class Vast.Array : Object size_t origin = 0) requires (scalar_size > 0) requires (shape.length > 0)

  • requires (_size_from_shape (shape) > 0)

This is important no? It's prevents zeroes in shapes, which basically collapse the whole array.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rainwoodman/vast/pull/27#pullrequestreview-11254116, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIbTNcr_gpOkPPASfk9ihD-B6J-4Apaks5rEJ6ugaJpZM4LC-kB .

arteymix commented 7 years ago

Should we keep this since it's being addressed in #30 as well?

rainwoodman commented 7 years ago

Lets' close this in favor of #30

arteymix commented 7 years ago

Great! I really like the coming code :+1: