removed depedency on Vec
This commit is contained in:
parent
4add995c1b
commit
e86ab5db3d
|
@ -315,12 +315,11 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
DefaultAllocator: Reallocator<N, R, C, R, Dynamic>,
|
DefaultAllocator: Reallocator<N, R, C, R, Dynamic>,
|
||||||
{
|
{
|
||||||
let mut m = self.into_owned();
|
let mut m = self.into_owned();
|
||||||
let mut v: Vec<usize> = indices.to_vec();
|
|
||||||
let (nrows, ncols) = m.data.shape();
|
let (nrows, ncols) = m.data.shape();
|
||||||
let mut offset: usize = 0;
|
let mut offset: usize = 0;
|
||||||
let mut target: usize = 0;
|
let mut target: usize = 0;
|
||||||
while offset + target < ncols.value() {
|
while offset + target < ncols.value() {
|
||||||
if v.contains(&(target + offset)) {
|
if indices.contains(&(target + offset)) {
|
||||||
offset += 1;
|
offset += 1;
|
||||||
} else {
|
} else {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -339,13 +338,13 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
unsafe {
|
unsafe {
|
||||||
Matrix::from_data(DefaultAllocator::reallocate_copy(
|
Matrix::from_data(DefaultAllocator::reallocate_copy(
|
||||||
nrows,
|
nrows,
|
||||||
ncols.sub(Dynamic::from_usize(v.len())),
|
ncols.sub(Dynamic::from_usize(offset)),
|
||||||
m.data,
|
m.data,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes all columns in `indices`
|
/// Removes all rows in `indices`
|
||||||
#[cfg(any(feature = "std", feature = "alloc"))]
|
#[cfg(any(feature = "std", feature = "alloc"))]
|
||||||
pub fn remove_rows_at(self, indices: &[usize]) -> MatrixMN<N, Dynamic, C>
|
pub fn remove_rows_at(self, indices: &[usize]) -> MatrixMN<N, Dynamic, C>
|
||||||
where
|
where
|
||||||
|
@ -353,12 +352,11 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
DefaultAllocator: Reallocator<N, R, C, Dynamic, C>,
|
DefaultAllocator: Reallocator<N, R, C, Dynamic, C>,
|
||||||
{
|
{
|
||||||
let mut m = self.into_owned();
|
let mut m = self.into_owned();
|
||||||
let mut v: Vec<usize> = indices.to_vec();
|
|
||||||
let (nrows, ncols) = m.data.shape();
|
let (nrows, ncols) = m.data.shape();
|
||||||
let mut offset: usize = 0;
|
let mut offset: usize = 0;
|
||||||
let mut target: usize = 0;
|
let mut target: usize = 0;
|
||||||
while offset + target < nrows.value() * ncols.value() {
|
while offset + target < nrows.value() * ncols.value() {
|
||||||
if v.contains(&((target + offset) % nrows.value())) {
|
if indices.contains(&((target + offset) % nrows.value())) {
|
||||||
offset += 1;
|
offset += 1;
|
||||||
} else {
|
} else {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -373,7 +371,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Matrix::from_data(DefaultAllocator::reallocate_copy(
|
Matrix::from_data(DefaultAllocator::reallocate_copy(
|
||||||
nrows.sub(Dynamic::from_usize(v.len())),
|
nrows.sub(Dynamic::from_usize(offset / ncols.value ())),
|
||||||
ncols,
|
ncols,
|
||||||
m.data,
|
m.data,
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue