You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to migrate ndarray-linalg away from the use of ArrayBase::uninitialized to ArrayBase::uninit. I do not see how to do the conversion in the following case (simplified from ndarray_linalg::convert::clone_with_layout:
fnfoo<A,Si,So>(a:&ArrayBase<Si,Ix2>) -> ArrayBase<So,Ix2>whereA:Copy,Si:Data<Elem = A>,So:DataOwned<Elem = A> + DataMut,{let layout:(usize,usize) = (1,1);// simplified from the originalletmut b = ArrayBase::uninitialized(layout);
b.assign(a);
b
}
My best attempt is:
fnfoo<A,Si,So>(l:MatrixLayout,a:&ArrayBase<Si,Ix2>) -> ArrayBase<So,Ix2>whereA:Copy,Si:Data<Elem = A>,So:DataOwned<Elem = A> + DataMut,{let layout:(usize,usize) = (1,1);// simplified from the originalletmut b:ArrayBase<<SoasDataOwned>::MaybeUninit,Ix2> = ArrayBase::uninit(layout);
a.assign_to(&mut);unsafe{ b.assume_init()}}
which does not work because the storage for b does not impl DataMut.
Is the use of DataOwned::MaybeUninit::uninit the way to go ? Then how can I initialize it, since it doesn't implement DataMut ?
The text was updated successfully, but these errors were encountered:
Threre is an internal way to do that (see build_uninit in the source) - but it's not quite ready for public consumption - needs to use an ArrayViewMut instead. At the moment there is no clean (it's possible with extra bounds) way to do this generically for all owned arrays.
In other words, it should currently be good enough for using specific owned arrays directly but maybe the build_uninit method needs exposing for generic methods.
Uh oh!
There was an error while loading. Please reload this page.
I am trying to migrate
ndarray-linalg
away from the use ofArrayBase::uninitialized
toArrayBase::uninit
. I do not see how to do the conversion in the following case (simplified fromndarray_linalg::convert::clone_with_layout
:My best attempt is:
which does not work because the storage for
b
does not implDataMut
.Is the use of
DataOwned::MaybeUninit::uninit
the way to go ? Then how can I initialize it, since it doesn't implementDataMut
?The text was updated successfully, but these errors were encountered: