use super::{
accessors::{RandomAccessByValue, RandomAccessMut},
base_operations::BaseItem,
};
pub trait AijIteratorByValue: BaseItem {
fn iter_aij_value(&self) -> impl Iterator<Item = ([usize; 2], Self::Item)> + '_;
}
pub trait AijIteratorByRef: BaseItem {
fn iter_aij_ref(&self) -> impl Iterator<Item = ([usize; 2], &Self::Item)> + '_;
}
pub trait AijIteratorMut: BaseItem {
fn iter_aij_mut(&mut self) -> impl Iterator<Item = ([usize; 2], &mut Self::Item)> + '_;
}
pub trait AsMultiIndex<T, I: Iterator<Item = (usize, T)>, const NDIM: usize> {
fn multi_index(
self,
shape: [usize; NDIM],
) -> crate::dense::array::iterators::MultiIndexIterator<I, NDIM>;
}
pub trait ArrayIteratorByValue: BaseItem {
type Iter<'a>: Iterator<Item = Self::Item>
where
Self: 'a;
fn iter_value(&self) -> Self::Iter<'_>;
}
pub trait ArrayIteratorByRef: BaseItem {
type Iter<'a>: Iterator<Item = &'a Self::Item>
where
Self: 'a;
fn iter_ref(&self) -> Self::Iter<'_>;
}
pub trait ArrayIteratorMut: BaseItem {
type IterMut<'a>: Iterator<Item = &'a mut Self::Item>
where
Self: 'a;
fn iter_mut(&mut self) -> Self::IterMut<'_>;
}
pub trait GetDiagByRef: BaseItem {
type Iter<'a>: Iterator<Item = &'a Self::Item>
where
Self: 'a;
fn diag_iter_ref(&self) -> Self::Iter<'_>;
}
pub trait GetDiagByValue: BaseItem {
type Iter<'a>: Iterator<Item = Self::Item>
where
Self: 'a;
fn diag_iter_value(&self) -> Self::Iter<'_>;
}
pub trait GetDiagMut: BaseItem {
type Iter<'a>: Iterator<Item = &'a mut Self::Item>
where
Self: 'a;
fn diag_iter_mut(&mut self) -> Self::Iter<'_>;
}
pub trait ColumnIterator: BaseItem {
type Col<'a>: RandomAccessByValue<1, Item = Self::Item>
where
Self: 'a;
type Iter<'a>: Iterator<Item = Self::Col<'a>>
where
Self: 'a;
fn col_iter(&self) -> Self::Iter<'_>;
}
pub trait RowIterator: BaseItem {
type Row<'a>: RandomAccessByValue<1, Item = Self::Item>
where
Self: 'a;
type Iter<'a>: Iterator<Item = Self::Row<'a>>
where
Self: 'a;
fn row_iter(&self) -> Self::Iter<'_>;
}
pub trait ColumnIteratorMut: BaseItem {
type Col<'a>: RandomAccessMut<1, Item = Self::Item>
where
Self: 'a;
type Iter<'a>: Iterator<Item = Self::Col<'a>>
where
Self: 'a;
fn col_iter_mut(&mut self) -> Self::Iter<'_>;
}
pub trait RowIteratorMut: BaseItem {
type Row<'a>: RandomAccessMut<1, Item = Self::Item>
where
Self: 'a;
type Iter<'a>: Iterator<Item = Self::Row<'a>>
where
Self: 'a;
fn row_iter_mut(&mut self) -> Self::Iter<'_>;
}