Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007339OCamlotherlibspublic2016-08-30 08:512016-09-01 19:18
Assigned Togasche 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.05.0 +dev/beta1/beta2/beta3/rc1 
Summary0007339: Support bigarray with 0 dimension as scalar
DescriptionI'm wondering if there is some specific reason for not supporting the '0 dimension' case for bigarrays. This case is handled in some other numerical libraries, e.g. numpy or tensorflow, with the natural semantics of being a scalar value.

I tried relaxing the exceptions that currently prevent this case in the branch below + added some tests and it seems to work fine with a quite simple change: [^]

Note that this doesn't include any support for the bigarray.{} syntax, not sure how worthy this is.

To give some context I came along this when writing some tensorflow ocaml bindings and the current workaround is to have a wrapper around the bigarray module that handles this scalar case with a bigarray with one dimension of size one. However this isn't very neat as it requires the wrapper to store whether the embedded data is a scalar or not. It would be quite nicer to have this supported by the bigarray module directly.

Would this sound like a reasonable change ?
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (administrator)
2016-08-30 09:01

It does sound like a reasonable change to me, you should consider submitting a github pull request.

(You could squash the commits in your branch, and you should add a Changes entry in the "Next version" section.)
laurent.mazare (reporter)
2016-08-30 09:52

Ok thanks I've added the Changes entry and submitted a PR.
laurent.mazare (reporter)
2016-09-01 18:05

For reference, the PR is [^]
gasche (administrator)
2016-09-01 19:18
edited on: 2016-09-01 19:18

The proposed implementation is now merged in trunk (will not be part of the feature-frozen 4.04.0, but of the next release after that, probably 4.05). Thanks!

- Issue History
Date Modified Username Field Change
2016-08-30 08:51 laurent.mazare New Issue
2016-08-30 09:01 gasche Note Added: 0016246
2016-08-30 09:52 laurent.mazare Note Added: 0016247
2016-09-01 18:05 laurent.mazare Note Added: 0016258
2016-09-01 19:18 gasche Note Added: 0016259
2016-09-01 19:18 gasche Status new => resolved
2016-09-01 19:18 gasche Fixed in Version => 4.05.0 +dev/beta1/beta2/beta3/rc1
2016-09-01 19:18 gasche Resolution open => fixed
2016-09-01 19:18 gasche Assigned To => gasche
2016-09-01 19:18 gasche Note Edited: 0016259 View Revisions
2017-02-23 16:42 doligez Category OCaml otherlibs => otherlibs

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker