Taking an ndarray view on a C++ array

I'm writing a Rust library that will accept multiple large arrays from a C++ client. These arrays will be passed as simple 1D arrays, but they are really n-dimensional.

The contents of the arrays will be modified (to return updates to the client).

As the arrays are large, I don't want to copy them. So, I'm looking to create an n-dimensional view of the underlying 1D data, modifying that underlying 1D array via safe operations on an ndarray view.

My question is how I should create a view on the existing data to avoid any copies.

I believe the correct method to use would be

ndarray::ArrayViewMut.from_shape_ptr

Is that the correct approach for my use case?

It looks correct to me.

Good news. Thanks, droundy.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.