Function returning ndarray with given size

⚓ rust    📅 2025-05-07    👤 surdeus    👁️ 4      

surdeus

Warning

This post was published 56 days ago. The information described in this article may have changed.

I am trying to implement a whole bunch of generic functions, using ndarray, that all should

  • take in an array size the same way Array::zeros() does, so as either a usize or an n-tuple of usize
  • return an array with the given size
    I can do this for, say, Array1, but since i'm translating MATLAB code I really need it to work for any size, so I guess something like -> Array<T, IxDyn>?
    I've looked at things like shape: S with S : Into<IxDyn>, but so far all my attempts have been rejected by the compiler.

5 posts - 2 participants

Read full topic

🏷️ rust_feed