arts icon indicating copy to clipboard operation
arts copied to clipboard

New types for ARTS-3

Open riclarsson opened this issue 1 year ago • 3 comments

Hi all,

We should decide the future of the use of a type system in ARTS. There's numerous ideas of how to improve it in a few PRs so I thought we gather those here.

I will present only the problem I have with some of our use of matrices and vectors here, but I know @erikssonpatrick also is considering exposing Complex (and perhaps a few multi-dimensional access to it?) as yet-another-type for the users.

But we should also decide if we want the solution below, or if it would be better for LOS and POS to be the types, and Ppath to contain lists of these.


Vector and Matrix Limitations

The problem: The propagation matrix calculations requires an Agenda call, so its input line-of-sight has to be a Vector today. But Ppath can only give VectorView from the Matrix it holds, so the data has to be copied. VectorView is not and should not be a user type. On the other hand, using ArrayOfVector in Ppath would make the data non-exhaustive (a Vector has a pointer, so it is effectively an Array<> of pointers) which means it would be less efficient to work with Ppath. It must have been decided in the past that this is not a good trade-off to make and that Ppath must have exhaustive data.

The suggested solution: Expose some fixed-size multidimensional arrays to the user. Most notably, Vector2 and Vector3, which can be used as ArrayOfVector2 and ArrayOfVector3 in Ppath. These can then be accessed without the need of copying, and the data will be exhaustive in Array<> form because a VectorX does not need a pointer if implemented as matpack::matpack_constant_data<Numeric, X>.

New user types: Vector2; Vector3; ArrayOfVector2; ArrayOfVector3

riclarsson avatar Apr 11 '23 08:04 riclarsson