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 want to make SliceInfo for generic ObsD dimension.
Like if ObsD == Ix1 then Array1::Slice_mut( sliceInfo_with_Ix1 ), if ObsD == Ix2 then Array2::Slice_mut( sliceInfo_with_Ix2 ) slice_mut argument seems need bound with SliceArg<D>.
And in the code slice.rs, it seems SliceArg implemented with all kind of input dimensions with macros.
Like this
[E0277] the trait bound `SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>` is not satisfied. [Note] the trait `SliceArg<D>` is not implemented for `SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>`...
I cannot impl SliceArg<D> manually cause it is private.
Can you give any help?
The text was updated successfully, but these errors were encountered:
I cannot impl SliceArg manually cause it is private.
This is intentional, c.f. https://docs.rs/ndarray/latest/src/ndarray/slice.rs.html#309. An incorrect implementation could break safety invariants and the project is not willing to commit to documenting and maintaining an unsafe interface at the moment. (Meaning the exact requirements for implementing SliceArg are not part of the API and can change at any point in time, even in patch releases.)
You got some point, so I tried hard but with my brain, I couldn't make it.
So I slice it with index_axis_mut(). with that It solved.
impl<ObsD,ObsT>Store<(Array<ObsT,ObsD>)>forPrioritizedReplayBuffer<ObsD,ObsT,ActD,ActT>whereObsD: ndarray::Dimension + RemoveAxis,ObsT:PartialOrd + Default + Debug + Zero + Display,{fnstore(&mutself,(obs):(Array<ObsT,ObsD>)){self.data.index_axis_mut(Axis(0), idx).assign(&obs);//self.data is Array(ObsT,ObsD).}}
But It is hard to make new Array with Genrics.
I'm afraid to lose performance with using ArrayD (dynamic array).
But May be that's the high, clean way.
I want to make
SliceInfo
for genericObsD
dimension.Like if
ObsD == Ix1
thenArray1::Slice_mut( sliceInfo_with_Ix1 )
, ifObsD == Ix2
thenArray2::Slice_mut( sliceInfo_with_Ix2 )
slice_mut
argument seems need bound withSliceArg<D>
.And in the code
slice.rs
, it seemsSliceArg
implemented with all kind of input dimensions with macros.Like this
So I write code.
But the compiler says
[E0277] the trait bound `SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>: SliceArg<D>` is not satisfied. [Note] the trait `SliceArg<D>` is not implemented for `SliceInfo<[SliceInfoElem; 1], Dim<[usize; 1]>, Dim<[usize; 1]>>`...
I cannot impl
SliceArg<D>
manually cause it is private.Can you give any help?
The text was updated successfully, but these errors were encountered: