Section: 29.7 [numarray] Status: NAD Submitter: Nico Josuttis Opened: 1998-09-29 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [numarray].
View all issues with NAD status.
You can easily create subsets, but you can't easily combine them with other subsets. Unfortunately, you almost always needs an explicit type conversion to valarray. This is because the standard does not specify that valarray subsets provide the same operations as valarrays.
For example, to multiply two subsets and assign the result to a third subset, you can't write the following:
va[slice(0,4,3)] = va[slice(1,4,3)] * va[slice(2,4,3)];
Instead, you have to code as follows:
va[slice(0,4,3)] = static_cast<valarray<double> >(va[slice(1,4,3)]) * static_cast<valarray<double> >(va[slice(2,4,3)]);
This is tedious and error-prone. Even worse, it costs performance because each cast creates a temporary objects, which could be avoided without the cast.
Extend all valarray subset types so that they offer all valarray operations.
This is not a defect in the Standard; it is a request for an extension.